403398: GYM101149 M Ex Machina

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

M. Ex Machinatime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Special agent Adam is hacking a calculator of a member of the secret mason organization of Illuminati in order to get access to the information about its leaders. He has already found out that the organization consists of n members, each of which has its own unique index number from 1 to n. Moreover, every member of the organization has a level which is also an integer from 1 to n, and all levels are pairwise distinct. Every Illuminati can give commands to Illuminati of lower levels, but has to obey the Illuminati of higher levels. Adam thinks that the information leak about the Illuminati with the highest level n can discredit him, so he is interested in the Illuminati with the level n - 1, who obeys only the Illuminati with the highest level.

It was quite hard to get access to the secret Illuminati network, so the only request Adam can make is to compare levels of two Illuminati with the given index numbers. Making such request, he gets a response which tells if the level of the first Illuminati is higher, lower or equal to the level of the second Illuminati. The number of requests is limited, but as the Illuminati's calculator highly respects powers of two, Adam can safely make requests before his presence in the network will be detected.

Interaction

It's an interactive problem. Here, your program must communicate with the jury's program using standard input and output.

At the beginning, the input contains a line with a single integer n (2 ≤ n ≤ 1000) — the number of Illuminati.

After that your program can make requests to compare two Illuminati. To do that, in a separate line output a character «?» and then two integers, separated by spaces — the index numbers of Illuminati to compare. As a response, a separate line will contain a character «<» if the first Illuminati has the level lower than the second one, a character «>» if the first Illuminati has the level higher than the second one, or a character «=» if the given Illuminati have the same level. You can make no more than such requests.

When you will know the answer, output a character «!» and a single integer, separated by a space — the index number of Illuminati with the level n - 1.

ExampleInput
5
>
>
>
>
>
<
>
Output
? 1 2
? 1 3
? 1 4
? 1 5
? 2 3
? 2 4
? 4 5
! 4
Note

Notice that after printing each message your program must flush the output buffer so that the information you have printed reached the jury's program. For example, the calls «fflush(stdout)» or «cout.flush()» in C++, «System.out.flush()» in Java, «Console.Out.Flush()» in C#, «flush(output)» in Pascal, «sys.stdout.flush()» in Python do that.

加入题单

算法标签: