Kotlin Heroes: Episode 8 |
---|

Finished |

The following languages are only available languages for the problems from the contest

Kotlin Heroes: Episode 8:

- Kotlin 1.7.20
- Kotlin 1.9.21

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

*special problem

*800

No tag edit access

The problem statement has recently been changed. View the changes.

×
A. Sequence of Comparisons

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputOnce upon a time, Petya had an array of integers $$$a$$$ of length $$$n$$$. But over time, the array itself was lost, and only $$$n-1$$$ results of comparisons of neighboring array elements remained. In other words, for every $$$i$$$ from $$$1$$$ to $$$n-1$$$, Petya knows exactly one of these three facts:

- $$$a_i < a_{i+1}$$$;
- $$$a_i = a_{i+1}$$$;
- $$$a_i > a_{i+1}$$$.

Petya wonders if it is possible to uniquely determine the result of comparing $$$a_1$$$ and $$$a_n$$$.

You have to help Petya determine the result of comparing $$$a_1$$$ and $$$a_n$$$ or report that the result cannot be determined unambiguously.

Input

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 500$$$) — the number of test cases.

The only line of the test case contains the string $$$s$$$ ($$$1 \le |s| \le 100$$$), where $$$s_i$$$ is:

- <, if $$$a_i < a_{i + 1}$$$;
- >, if $$$a_i > a_{i + 1}$$$;
- =, if $$$a_i = a_{i + 1}$$$.

Output

For each test case, print a single string equal to:

- <, if $$$a_1 < a_n$$$;
- >, if $$$a_1 > a_n$$$;
- =, if $$$a_1 = a_n$$$;
- ?, if it is impossible to uniquely determine the result of the comparison.

Example

Input

4 >>> <><=< = <<==

Output

> ? = <

Note

Consider the test cases of the example:

- in the first test case, it's easy to see that $$$a_1 > a_4$$$ since $$$a_1 > a_2 > a_3 > a_4$$$;
- in the second test case, both sequences $$$[1, 2, 0, 10, 10, 15]$$$ and $$$[10, 11, 1, 2, 2, 5]$$$ meet the constraints; in the first one, $$$a_1 < a_6$$$, and in the second one, $$$a_1 > a_6$$$, so it's impossible to compare $$$a_1$$$ and $$$a_6$$$;
- in the third test case, we already know that $$$a_1 = a_2$$$;
- in the fourth test case, it's easy to see that $$$a_3 = a_4 = a_5$$$, and $$$a_1 < a_2 < a_3$$$, so $$$a_1 < a_5$$$.

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jul/19/2024 22:12:11 (h2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|