There are N students in a grade, each student belongs to only one class.Now all they standing in a row,but students in the same class are not necessarily going to stand together. Everyone will say a sentence like "Well,there are Ai my classmates stand on my left,as well as Bi my classmates on the right".But not everyone will tell the truth,the teacher also forgot their order of speech.Now the teacher want to know maximum number of people say without contradiction.
There are multiple test cases, no more than 100 cases. In each test case, the first line contains a single integer N.$(1\leq N\leq 1000 )$ The following N lines specify the people. Each of them contains two integers Ai and Bi separated by single spaces.$(0\leq Ai,Bi\leq 1000 )$