A group of bandits has hidden a stolen treasure in a room. The door to the room should be unlocked only when it is necessary to take the treasure out. Since the bandits do not trust each other, they want to be able to open the room and take the loot only if at least of them agree to do so.
They decided to install several locks on the door in such a way that it opens only when all the locks are opened. Each lock may have up to keys, distributed among some subset of the bandits. A group of bandits can open a lock if and only if at least one member of the group possesses a key to that lock.
Given the values and , determine the minimum possible number of locks such that, with a proper distribution of keys every group consisting of at least bandits can open all the locks, while no group of smaller size can open all the locks.
For example, when n = 3 and m = 2, it is sufficient to have locks. The keys to lock are given to bandits and , the keys to lock are given to bandits and , and the keys to lock are given to bandits and . No bandit can open all the locks alone, but any group of two bandits can open all of them. It is easy to see that two locks are not sufficient in this case.
The first line contains the number of test cases. Each of the following lines corresponds to one test case and contains two integers n~(1 \le n \le 30) and m~(1 \le m \le n).
For each test case, print the minimum number of required locks on a separate line.
Example 1