URI Online Judge | 3092

# Guys' Truco 2.0

By Ygor Ribeiro, IFSULDEMINAS Brazil

Timelimit: 1

Guys' Truco, The most exciting game of IFSULDEMINAS, is making players more and more involved. Again, Theusin of teens and gameplays, as he is known, has a problem with another superstition in relation to the game.

In the previous exercise, what mattered for Theusin was to know if the cards {Q, J, K, A} appeared on the pile so that he believed he would not lose points in the round, but how his friends LeoP and JoaoG were playing tricks and doing it losing even if it did, he created a stronger and harder to happen superstition.

Again imagine a deck of cards from 2 to 7 and {Q, J, K, A} as the cards that are part of the game. Disregard the suits and the equal number of cards that can occur, since the game is being played with several decks together so that all the many participants can play.

Example: After all the letters were distributed to the participants, the remaining ones were as follows, in that order: {2, 5, 8, J, A, A, 7, 3, Q, 4, K}.

This time the boy's superstition did not occur, since now he wants to know if the letters {Q, J, K, A} appear on the pile and this time exactly in that order, first the letter Q, then J, then K, up to A. ATTENTION: The cards in the pile cannot have their order changed and if any card of the sequence appears before its previous one, with the exception of the Q card, it is disregarded.

As we can see in the example, the order of the cards that are part of your superstition is as follows: {J, A, Q, K}. The cards don't necessarily need to be one after the other, just need the Q to appear first, and so on until the A.

Example: Cards left in the pile: {5, 6, A, K, 2, Q, 4, J, 3, K, 7, A, Q}. In this case superstition occurs, because it is possible to set up the boy's sequence without changing the order of the

## Input

The first line of input contains an integer N (1 <= N <= 20), which indicates the number of test cases. The next N lines contain a String S (1 <= |S| <= 1000), with no spaces, showing all the cards left in the pile after the cards were dealt to the players.

## Output

For each test case line, print "Agora vai", without quotes, if Theusin believes he will not lose points in the round, or "Agora apertou sem abracar", without quotes, if he thinks he will lose, that is, his superstition do not occur.

 Input Samples Output Samples 2 258JAA73Q4K 56AK2Q4J3K7AQ Agora apertou sem abracar Agora vai