P13704 [NWERC 2023] Exponentiation

Description

In her spare time, Zoe develops an online calculator. Unfortunately, the calculator was targeted by a denial-of-service attack last week. The attacker created a lot of integer variables, exponentiated them with each other, and tried to do a bunch of comparisons. The huge integers were too much for the server to handle, so it crashed. Before Zoe fixes the issue, she decides to actually perform the calculations that the attacker requested. ![图片太大了传不上洛谷](https://img.freepik.com/free-vector/year-2023-logo-fireworks-with-text-space-vector-illustration-celebrating-new-year_8130-1168.jpg?t=st=1754811651~exp=1754815251~hmac=433ff45e8eeb4dbfe54c3c97b3fac5d2a82fb55b335a23cd097eb5d8395e35ba&w=2000) :::align{center} Image by callmetak on [Freepik](https://www.freepik.com/free-vector/year-2023-logo-fireworks-with-text-space-vector-illustration-celebrating-new-year_29660812.htm) ::: There are $n$ integer variables $x_1, x_2, \dots, x_n$. At the start, each variable is set to $2023$. You have to perform $m$ instructions of the following two types: - *Operations*, of the form "$\texttt{! i j}$", where $i \neq j$. This means that $x_i$ gets set to $x_i^{x_j}$. - *Queries*, of the form "$\texttt{? i j}$", where $i \neq j$. This means that you should print '$\verb|>|$' if $x_i$ is greater than $x_j$, '$\verb|=|$' if $x_i$ is equal to $x_j$, and '$\verb|

Input Format

The input consists of: - One line with two integers $n$ and $m$ ($2 \leq n \leq 1000$, $1 \leq m \leq 1000$), the number of variables and the number of instructions. - $m$ lines, each containing a character $c$ (either '$\texttt{!}$' or '$\texttt{?}$') and two integers $i$ and $j$ ($1 \leq i, j \leq n$, $i \neq j$), describing the instructions.

Output Format

For every query in the input, output its answer.