E. Tokens
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You and your little brother cannot agree on who has the right to use the home computer.

You want to use it to practice OIE problems, while he thinks he will spend the afternoon playing a video game that is too violent for his age. There is only one way to resolve this family dispute: with a game of tokens.

The game takes place on a board shaped like a regular $$$n$$$-gon. Initially, your brother will place a token on any vertex of the $$$n$$$-gon. From then on, you will play a maximum of $$$k=15$$$ rounds.

In each round, you will first choose and loudly announce an integer $$$d$$$ between $$$1$$$ and $$$n-1$$$. Then, your brother will choose a direction, either clockwise or counterclockwise. He will then place a new token on the vertex that results from moving $$$d$$$ vertices in the direction he has chosen from the last place he placed a token (that is, from the vertex where he placed a token in the previous round, or in the case of the first round, from where he placed a token at the start of the game).

You play with the rule that you cannot place a second token on a square that already has a token. Your brother wins if he survives the $$$k$$$ rounds without placing two tokens in the same spot (that is, if he ends up placing $$$k+1$$$ tokens in different locations, the one he places at the beginning and the ones he places in the $$$k$$$ rounds). You win if in any of the rounds your brother cannot make any legal move. Design a program to win against your brother.

Interaction

This is an interactive problem. You must refresh the output every time you print data (cout «   endl or cout «   flush in C++, System.out.flush() in Java, sys.stdout.flush() in Python)

Each input begins with an integer $$$T$$$, the number of cases. Each case is an independent game where the interaction proceeds as follows:

First, you must read a line that will contain the two integers $$$n$$$ and $$$k$$$, the number of sides of the $$$n$$$-gon and the maximum number of turns.

Next, there will be a maximum of $$$k$$$ turns. In the $$$i$$$-th turn, you will first print the integer $$$d$$$ that you have chosen on a single line.

After that, to receive your brother's move, you will need to read a single line, which will contain only one character: > if your brother chooses the clockwise direction, < if your brother chooses the counterclockwise direction, = if your brother has no legal moves (and thus you have won), or - if you wrote an invalid value of $$$d$$$ or it was the $$$k$$$-th round and your brother has any legal moves (and thus you have lost).

If your program reads > or <, it will proceed to the next turn, which will proceed the same way. If it reads =, then you will have won and the case will end. If it is the last case, your program must terminate immediately to be accepted. If not, the next case will start from scratch (that is, you will start by reading $$$n$$$ and $$$k$$$, and then the turns will be played).

If you read -, your program must terminate immediately to receive the verdict "Incorrect answer" in CMS. Otherwise, your program could receive arbitrary verdicts.

Scoring
  1. (7 points) $$$n\le 15$$$.
  2. (12 points) $$$n\le 25$$$.
  3. (23 points) $$$n\le 55$$$.
  4. (6 points) $$$n$$$ is even.
  5. (13 points) $$$n$$$ is neither prime nor the product of two primes.
  6. (20 points) $$$n$$$ is not prime.
  7. (19 points) No additional restrictions.

In each subtask, you will receive full points if and only if you win all cases of all tests.

Example
Input
2
5 15

>

<

=
7 15

<

>

<

=
Output

3

4


6

4

1

3
Note
  • $$$1 \le T \le 1000$$$
  • $$$3 \le n \le 1000$$$
  • $$$k = 15$$$
  • The $$$d$$$ you print must be integers between $$$1$$$ and $$$n-1$$$ (both included).