Royal Croquet 2
"Everyone to their places!" shouted the Queen in a thunderous voice. Chaos ensued as everyone scrambled, bumping into each other, falling, and quickly getting back up. But within a minute, everyone was in their place, and the game began.
Alice thought she had never seen such a peculiar croquet groundfor playing croquet: it was full of holes and furrows. The balls were hedgehogs, the mallets were flamingos, and the arches were soldiers. The soldiers formed arches and stood still throughout the game.
Initially, Alice struggled to control her flamingo: she would tuck it under her arm with its head down, pull its legs back, aim, and prepare to hit the hedgehog, only for it to bend its neck and look her straight in the eyes, causing her to laugh. By the time she managed to get it head down again, the hedgehog would have wandered off. Moreover, all her hedgehogs fell into holes, and the soldier-arches would straighten up and move to the other end of the ground. In short, Alice quickly concluded that this was a very challenging game.
Alice's Adventures in Wonderland (translated by N.M. Demurova)
In addition to the unusual ground and living sports equipment, the rules of this wonder-game were equally strange and confusing. All players hit at once, without waiting for their turn, constantly arguing and fighting over the hedgehogs. The Queen quickly became furious, stomping her feet and repeatedly shouting:
"Off with her head! Off with his head!"
Nevertheless, there are rules.
The game can be played by 2 to 5 players. Players take turns hitting their hedgehogs, trying to get them through the arches.
Serve
Each point begins with a serve. The right to serve rotates continuously among the players throughout the game.
Game
Each game starts with a score of zero. For the first two successful hits through the arches, a player earns 15 points each, and for the third, another 10. The next successful hit results in winning the game if the opponents have a score of 30 or less. If all players have 40, winning the next serve gives an advantage. A player with an advantage who wins the next serve wins the game.
Set
A player who wins 6 games is considered to have won the set. If after 6 sets the next leading player has scored 5 points, another game is played. If the gap increases, the set ends. Otherwise, a tiebreak is played.
Match
A match can be 3-set or 5-set (at the discretion of the Queen of Hearts). In a 3-set match, the player who wins 2 sets wins, and in a 5-set match, 3 sets. The Queen orders the others to be beheaded, but since the executioner usually starts arguing, complaining about low pay, sciatica, and a dull axe, this is done very rarely.
Tiebreak
Players take turns making one hit each. The first to score 7 points with a 2 point difference is considered to have won the tiebreak. The tiebreak lasts as long as necessary until a two-point difference is achieved. The last set in the game is played without a tiebreak.
The Cheshire Cat watched the whole game, smiling thoughtfully, and recorded the game protocol—that is, the player who won each serve. Determine who won this extraordinary competition.
Input
The input file consists of several lines, each describing a separate game. Each line contains the game protocol: first, an integer N (2 ≤ N ≤ 5)—the number of players, followed by a string of uppercase English letters. Each letter in the string represents a player (A—first, B—second, etc.) who won a serve. The number of letters does not exceed 100000.
Output
For each game, output a single character on a separate line representing the winner of the corresponding game.