Locked Treasure
A group of bandits hid their stolen treasure in a room. The treasure needs to be locked away until there is a need to retrieve it. Since the bandits do not trust each other, they wanted to ensure that at least of the bandits must agree in order to retrieve the treasure.
They have decided to place multiple locks on the door such that the door can be opened if and only if all the locks are opened. Each lock may have up to keys, distributed to a subset of the bandits. A group of bandits can open a particular lock if and only if someone in the group has a key to that lock.
Given and , how many locks are needed such that if the keys to the locks are distributed to the bandits properly, then every group of bandits of size at least can open all the locks, and no smaller group of bandits can open all the locks?
For example, if and , only locks are needed — keys to lock can be given to bandits and , keys to lock can be given to bandits and , and keys to lock can be given to bandits and . No single bandit can open all the locks, but any group of bandits can open all the locks. You should also convince yourself that it is not possible to satisfy the requirements with only locks.
Input
The first line contains the number of cases to follow. Each case is specified by the two integers and on one line.
Output
For each line print on one line the minimum number of locks needed.