Double decker

John D. Controller works in Tourist-o-Matic, a company that organizes sightseeing double decker buses in Madrid. However, John’s job is very boring: he must check all the buses that leave the initial stop and record how many tourists there are on each deck. In order to make his job more enjoyable, he has created a little game. Instead of recording two numbers for each bus, he only records a single natural number (called rank) that perfectly determines the occupation of the bus. To calculate the rank, he distributes the buses by rows depending on the total number of tourists (the rank is the number next to each bus): John is not very good at maths, so he usually computes a wrong rank. Could you help him with a program? Input The first line contains the number A of buses that leave the initial stop. Then there are A lines with the format N M, where N is the number of tourists on the upper deck and M the number of tourists on the lower deck. The maximum occupation of each deck is 1,000. Output For each bus, the program will write a line with its rank. Sample Input 3 00 12 20 Sample Output 1 8 6