You are an intergalactic surgeon and you have an alien patient. For the purposes of this problem, we can and we will model this patient's body using a 2 × (2k + 1) rectangular grid. The alien has 4k + 1 distinct organs, numbered 1 to 4k + 1.

In healthy such aliens, the organs are arranged in a particular way. For example, here is how the organs of a healthy such alien would be positioned, when viewed from the top, for k = 4:

<image>

Here, the E represents empty space. 

In general, the first row contains organs 1 to 2k + 1 (in that order from left to right), and the second row contains organs 2k + 2 to 4k + 1 (in that order from left to right) and then empty space right after. 

Your patient's organs are complete, and inside their body, but they somehow got shuffled around! Your job, as an intergalactic surgeon, is to put everything back in its correct position. All organs of the alien must be in its body during the entire procedure. This means that at any point during the procedure, there is exactly one cell (in the grid) that is empty. In addition, you can only move organs around by doing one of the following things:

  * You can switch the positions of the empty space E with any organ to its immediate left or to its immediate right (if they exist). In reality, you do this by sliding the organ in question to the empty space; 
  * You can switch the positions of the empty space E with any organ to its immediate top or its immediate bottom (if they exist) only if the empty space is on the leftmost column, rightmost column or in the centermost column. Again, you do this by sliding the organ in question to the empty space. 



Your job is to figure out a sequence of moves you must do during the surgical procedure in order to place back all 4k + 1 internal organs of your patient in the correct cells. If it is impossible to do so, you must say so.

Input

The first line of input contains a single integer t (1 ≤ t ≤ 4) denoting the number of test cases. The next lines contain descriptions of the test cases.

Each test case consists of three lines. The first line contains a single integer k (1 ≤ k ≤ 15) which determines the size of the grid. Then two lines follow. Each of them contains 2k + 1 space-separated integers or the letter E. They describe the first and second rows of organs, respectively. It is guaranteed that all 4k + 1 organs are present and there is exactly one E.

Output

For each test case, first, print a single line containing either:

  * SURGERY COMPLETE if it is possible to place back all internal organs in the correct locations; 
  * SURGERY FAILED if it is impossible. 



If it is impossible, then this is the only line of output for the test case. However, if it is possible, output a few more lines describing the sequence of moves to place the organs in the correct locations. 

The sequence of moves will be a (possibly empty) string of letters u, d, l or r, representing sliding the organ that's directly above, below, to the left or to the right of the empty space, respectively, into the empty space. Print the sequence of moves in the following line, as such a string. 

For convenience, you may use shortcuts to reduce the size of your output. You may use uppercase letters as shortcuts for sequences of moves. For example, you could choose T to represent the string lddrr. These shortcuts may also include other shortcuts on their own! For example, you could choose E to represent TruT, etc.

You may use any number of uppercase letters (including none) as shortcuts. The only requirements are the following:

  * The total length of all strings in your output for a single case is at most 10^4; 
  * There must be no cycles involving the shortcuts that are reachable from the main sequence; 
  * The resulting sequence of moves is finite, after expanding all shortcuts. Note that the final sequence of moves (after expanding) may be much longer than 10^4; the only requirement is that it's finite. 



As an example, if T = lddrr, E = TruT and R = rrr, then TurTlER expands to:

  * TurTlER
  * lddrrurTlER
  * lddrrurlddrrlER
  * lddrrurlddrrlTruTR
  * lddrrurlddrrllddrrruTR
  * lddrrurlddrrllddrrrulddrrR
  * lddrrurlddrrllddrrrulddrrrrr



To use shortcuts, print each one of them in a single line as the uppercase letter, then space, and then the string that this shortcut represents. They may be printed in any order. At the end of all of those, print a single line containing DONE. 

Note: You still need to print DONE even if you don't plan on using shortcuts.

Your sequence does not need to be the shortest. Any valid sequence of moves (satisfying the requirements above) will be accepted.

Example

Input


2
3
1 2 3 5 6 E 7
8 9 10 4 11 12 13
11
34 45 6 22 16 43 38 44 5 4 41 14 7 29 28 19 9 18 42 8 17 33 1
E 15 40 36 31 24 10 2 21 11 32 23 30 27 35 25 13 12 39 37 26 20 3


Output


SURGERY COMPLETE
IR
R SrS
S rr
I lldll
DONE
SURGERY FAILED

Note

There are three shortcuts defined in the first sample output:

  * R = SrS
  * S = rr
  * I = lldll



The sequence of moves is IR and it expands to:

  * IR
  * lldllR
  * lldllSrS
  * lldllrrrS
  * lldllrrrrr
#include <bits/stdc++.h>
using namespace std;
int K, m, nxt_l[111], nxt_r[111], prv_l[111], prv_r[111], a[111], b[111],
    pos_l[111], pos_r[111], pos[111], rnk[111];
char s[10];
bool le[111], ri[111];
void push_l(int k) {
  for (int i = 1; i <= m; i++) b[i] = a[pos_l[i]];
  for (int i = 1; i <= m; i++)
    pos[a[pos_l[i]] = b[(i - k + m - 1) % m + 1]] = pos_l[i];
  for (int i = 0; i < k; i++) putchar('L');
}
void push_r(int k) {
  for (int i = 1; i <= m; i++) b[i] = a[pos_r[i]];
  for (int i = 1; i <= m; i++)
    pos[a[pos_r[i]] = b[(i - k + m - 1) % m + 1]] = pos_r[i];
  for (int i = 0; i < k; i++) putchar('R');
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &K);
    m = 2 * K + 1;
    for (int i = 1; i <= 4 * K + 2; i++) {
      scanf("%s", s);
      if (s[0] == 'E')
        a[i] = 0;
      else
        a[i] = atoi(s);
      le[i] = ri[i] = 0;
      if (a[i] >= 3 * K + 2) a[i]++;
    }
    bool can = 0;
    for (int i = 1; i <= 4 * K + 2; i++) {
      if (!a[i]) continue;
      for (int j = 1; j < i; j++) {
        if (!a[j]) continue;
        if (a[j] > a[i]) can ^= 1;
      }
    }
    if (can) {
      puts("SURGERY FAILED");
      continue;
    }
    puts("SURGERY COMPLETE");
    for (int i = 1; i <= K; i++) nxt_l[i] = i + 1;
    nxt_l[K + 1] = 3 * K + 1;
    for (int i = 3 * K + 1; i > 2 * K + 2; i--) nxt_l[i] = i - 1;
    nxt_l[2 * K + 2] = 1;
    for (int i = m; i > K + 1; i--) nxt_r[i] = i - 1;
    nxt_r[K + 1] = 3 * K + 3;
    for (int i = 3 * K + 3; i <= 4 * K + 1; i++) nxt_r[i] = i + 1;
    nxt_r[4 * K + 2] = m;
    for (int i = 1, st = 1; i <= m; i++) {
      pos_l[i] = st;
      rnk[st] = i;
      le[st] = 1;
      prv_l[nxt_l[st]] = st, st = nxt_l[st];
    }
    for (int i = 1, st = m; i <= m; i++) {
      pos_r[i] = st;
      rnk[st] = i;
      ri[st] = 1;
      prv_r[nxt_r[st]] = st, st = nxt_r[st];
    }
    int r = 0;
    for (r = 1; r <= 4 * K + 2; r++)
      if (a[r] == 0) break;
    if (le[r]) {
      int c = (r - 1) % m + 1;
      while (c <= K) putchar('r'), swap(a[r], a[r + 1]), c++, r++;
      if (r == K + 1) putchar('d'), swap(a[r], a[r + m]);
    } else {
      int c = (r - 1) % m + 1;
      while (c > K + 1) putchar('l'), swap(a[r], a[r - 1]), c--, r--;
      if (r == K + 1) putchar('d'), swap(a[r], a[r + m]);
    }
    for (int i = 1; i <= 4 * K + 2; i++)
      if (a[i]) pos[a[i]] = i;
    r = pos[K];
    if (!le[r]) {
      push_r((rnk[K + 1] - rnk[r] + m) % m);
      assert(pos[K] == K + 1);
    }
    for (int i = K; prv_l[i] != 3 * K + 1; i = prv_l[i]) {
      int u = prv_l[i], r = pos[u];
      if (r == prv_l[pos[i]]) continue;
      if (le[r]) {
        push_l((rnk[K + 1] - rnk[r] + m) % m);
        push_r(m - 1);
        push_l((rnk[3 * K + 1] - rnk[pos[i]] + m) % m);
        push_r(1);
      } else {
        push_l((rnk[3 * K + 1] - rnk[pos[i]] + m) % m);
        push_r((rnk[K + 1] - rnk[r] + m) % m);
      }
    }
    if (pos[K] != K) push_l((rnk[K] - rnk[pos[K]] + m) % m);
    r = pos[K + 2];
    if (!ri[r]) {
      int c = (rnk[K + 1] - rnk[r] + m) % m;
      push_l(c);
      push_r(1);
      push_l((m - c) % m);
    }
    for (int i = K + 2; prv_r[i] != 3 * K + 3; i = prv_r[i]) {
      int u = prv_r[i], r = pos[u];
      if (r == prv_r[pos[i]]) continue;
      if (ri[r]) {
        push_r((rnk[K + 1] - rnk[r] + m) % m);
        push_l(m - 1);
        push_r((rnk[3 * K + 3] - rnk[pos[i]] + m) % m);
        push_l(1);
      } else {
        push_r((rnk[3 * K + 3] - rnk[pos[i]] + m) % m);
        int c = (rnk[K + 1] - rnk[r] + m) % m;
        push_l(c);
        push_r(1);
        push_l((m - c) % m);
      }
    }
    if (pos[K + 2] != K + 2) push_r((rnk[K + 2] - rnk[pos[K + 2]] + m) % m);
    while (pos[K + 1] != K + 1) {
      push_l(m - 1), push_r(m - 1), push_l(1), push_r(1);
    }
    for (int i = K + 1; i <= 2 * K; i++) putchar('r');
    puts("");
    putchar('L');
    putchar(' ');
    putchar('u');
    for (int i = 0; i < K; i++) putchar('l');
    putchar('d');
    for (int i = 0; i < K; i++) putchar('r');
    puts("");
    putchar('R');
    putchar(' ');
    putchar('u');
    for (int i = 0; i < K; i++) putchar('r');
    putchar('d');
    for (int i = 0; i < K; i++) putchar('l');
    puts("");
    puts("DONE");
  }
  return 0;
}
