Lexicographic Comparison

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Consider aa and pp, two permutations of length nn. Initially, a_i=p_i=ia\_i=p\_i=i for all 1in1\le i\le n. Let AA be a sequence of permutations such that A_1=aA\_1=a and A_i,j=A_i1,p_jA\_{i,j}=A\_{i-1,p\_j} for all i1i\ge 1 and 1jn1\le j\le n.

There are three types of operations, where xx and yy are positive integers:

  1. swap_a xx yy: swap a_xa\_x and a_ya\_y, where 1x,yn1\le x, y\le n;
  2. swap_p xx yy: swap p_xp\_x and p_yp\_y, where 1x,yn1\le x, y\le n;
  3. cmp xx yy: compare A_xA\_x with A_yA\_y lexicographically.

For each operation of type 3, output the relationship between A_xA\_x and A_yA\_y. A permutation ss is lexicographically smaller than a permutation tt if and only if there exists an index ii such that s_i\<t_is\_i\<t\_i and s_j=t_js\_j=t\_j for all 1j\<i1\le j\<i.

입력

There are multiple test cases. The first line of input contains an integer TT (1T1051\le T\le 10^5), the number of test cases. For each test case:

The first line contains an integer nn and qq (1n,q1051\le n, q\le 10^5), the length of the permutations and the number of operations.

Each of the following qq lines contains one string ff and two integers xx and yy representing an operation. The string ff is one of "swap_a", "swap_p", and "cmp". If ff is "swap_a" or "swap_p" then 1x,yn1 \le x, y \le n. If ff is "cmp" then 1x,y10181 \le x, y \le 10^{18}.

It is guaranteed that both the sum of nn and the sum of qq over all tests do not exceed 10510^5.

출력

For each test case:

For each query, output "<" if A_xA\_x is lexicographically smaller than A_yA\_y; output ">" if A_xA\_x is lexicographically greater than A_yA\_y (in other words, A_yA\_y is lexicographically smaller than A_xA\_x); output "=" if A_x=A_yA\_x = A\_y.