A math joke, for your amusement. Two mathematicians sit in a car parked outside a house. Two people walk into the house. A little later, three people walk out of it. One of the mathematicians says: "If one more person goes in now, the house will be empty!"
You have very little sense of humor, so you write a program instead. Given the record of people entering and leaving the house, find the smallest number of people that must have been inside before the observation started. The number of people inside the house is never negative at any moment.
The first line contains a single integer T, the number of test cases. Each test case starts with a line containing a single integer M. The next M lines each contain two integers P1 and P2 separated by a space. Each of those lines describes two events in order: first P1 people enter the house, then P2 people leave it.
For each test case, print on its own line the smallest number of people that must have been inside the house at the beginning.