Sinterklaas ----------- Did you know that Santa Claus, also known as Saint Nicholas, Father Christmas, Kris Kringle, or simply "Santa", is a figure which was derived from the Dutch figure of Sinterklaas? Each year, Sinterklaas travels in November from Spain to the Netherlands by steamboat. Sinterklaas spends a few weeks in the Netherlands. Dutch children put their shoe in front of the fireplace on the evening of 5 December, then go to bed, and find the presents around the shoes on the morning of the 6th. Sinterklaas, assisted by many mischievous helpers called "Pieten", delivers these presents. In an attempt to avoid mischievous behaviour of the Pieten during the long trip by boat from Spain to the Netherlands, Sinterklaas has invented a simple, yet time consuming game. Those Pieten, who are in the mood to play the game, form a circle. The head Piet is always in the mood and brings a bag of "pepernoten." To start the game, Sinterklaas picks a random positive number. The head Piet says the number aloud, and passes one pepernoot to the Piet to the left of him. This Piet subtracts one from the number and says that number aloud, passing the pepernoot to the Piet to his left. This continues until a Piet receives the pepernoot, subtracts one and ends up with the result of zero. That Piet may eat the pepernoot. You are given the number of Pieten who are interested in playing this game (1 <= p <= 35). The head Piet is numbered 1, the Piet to his left 2, etc. You are also given the random positive number chosen by Sinterklaas (1 <= s <= 1000000000). You have to determine which Piet may eat the pepernoot at the end of the game. Input ----- Your program will be tested on one or more data sets. The first line contains an integer N (N < 100), which is the number of data sets. Each data set consists of a single line containing p and s, separated by a single space. Output ------ For each data set, your program should print the number of the Piet who wins the game and eats the pepernoot. Sample input ------------ 2 4 3 5 11 Sample output ------------- 4 2