Problem: 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

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int num[70];
string ans;
bool init(int n) {
  ans.clear();
  int id[70];
  memset(id, 0, sizeof(id));
  for (int i = 1; i <= n; i++) id[n - i + 1] = i;
  for (int i = n + 1; i <= 2 * n; i++) id[n + i + 1] = i;
  for (int i = 2 * n + 1; i <= 3 * n; i++) id[i - n + 1] = i;
  for (int i = 3 * n + 1; i <= 4 * n; i++) id[7 * n + 2 - i] = i;
  id[n + 1] = 4 * n + 1;
  for (int i = 1; i <= 4 * n + 2; i++) num[i] = id[num[i]];
  int u = 0;
  for (int i = 1; i <= 4 * n + 2; i++)
    if (!num[i]) {
      u = i;
      break;
    }
  if (u <= n) {
    for (int i = 1; i <= u; i++) ans += "r";
    ans += "d";
    for (int i = u; i > 1; i--) swap(num[i], num[i - 1]);
    swap(num[1], num[4 * n + 1]);
    swap(num[4 * n + 1], num[4 * n + 2]);
  } else if (u <= 2 * n) {
    for (int i = u; i <= 2 * n; i++) ans += "r";
    for (int i = u; i < 2 * n; i++) swap(num[i], num[i + 1]);
    swap(num[2 * n], num[4 * n + 2]);
  } else if (u <= 3 * n) {
    for (int i = u; i > 2 * n; i--) ans += "l";
    ans += "d";
    for (int i = u; i > 2 * n + 1; i--) swap(num[i], num[i - 1]);
    swap(num[2 * n + 1], num[4 * n + 1]);
    swap(num[4 * n + 1], num[4 * n + 2]);
  } else if (u <= 4 * n) {
    for (int i = u; i <= 4 * n; i++) ans += "l";
    for (int i = u; i < 4 * n; i++) swap(num[i], num[i + 1]);
    swap(num[4 * n], num[4 * n + 2]);
  } else if (u == 4 * n + 1) {
    ans += "d";
    swap(num[4 * n + 1], num[4 * n + 2]);
  }
  bool s = 0;
  for (int i = 1; i <= 4 * n + 1; i++)
    for (int j = i + 1; j <= 4 * n + 1; j++)
      if (num[i] > num[j]) s ^= 1;
  return s ^ 1;
}
void gettrans(int n) {
  printf("A ");
  putchar('u');
  for (int i = 1; i <= n; i++) putchar('l');
  putchar('d');
  for (int i = 1; i <= n; i++) putchar('r');
  printf("\n");
  printf("B ");
  for (int i = 1; i <= n; i++) putchar('l');
  putchar('u');
  for (int i = 1; i <= n; i++) putchar('r');
  putchar('d');
  printf("\n");
  printf("C ");
  putchar('u');
  for (int i = 1; i <= n; i++) putchar('r');
  putchar('d');
  for (int i = 1; i <= n; i++) putchar('l');
  printf("\n");
  printf("D ");
  for (int i = 1; i <= n; i++) putchar('r');
  putchar('u');
  for (int i = 1; i <= n; i++) putchar('l');
  putchar('d');
  printf("\n");
}
void swap1(int x, int y, int z, int n) {
  z -= 2 * n;
  for (int i = 1; i <= y; i++) ans += "A";
  for (int i = 1; i <= z; i++) ans += "C";
  for (int i = 1; i <= (x - y + 2 * n + 1) % (2 * n + 1); i++) ans += "A";
  for (int i = 1; i <= z; i++) ans += "D";
  for (int i = 1; i <= x; i++) ans += "B";
  z += 2 * n;
  swap(num[x], num[z]);
  swap(num[y], num[x]);
}
void swap2(int x, int y, int z, int n) {
  x -= 2 * n;
  y -= 2 * n;
  for (int i = 1; i <= y; i++) ans += "C";
  for (int i = 1; i <= z; i++) ans += "A";
  for (int i = 1; i <= (x - y + 2 * n + 1) % (2 * n + 1); i++) ans += "C";
  for (int i = 1; i <= z; i++) ans += "B";
  for (int i = 1; i <= x; i++) ans += "D";
  x += 2 * n;
  y += 2 * n;
  swap(num[x], num[z]);
  swap(num[y], num[x]);
}
void solve(int n) {
  int id = 0;
  for (int i = 1; i <= 4 * n + 1; i++)
    if (num[i] == 4 * n + 1) {
      id = i;
      break;
    }
  if (id <= 2 * n) {
    for (int i = 1; i <= id; i++) {
      ans += "A";
      swap(num[4 * n + 1], num[1]);
      for (int j = 1; j < 2 * n; j++) swap(num[j], num[j + 1]);
    }
  } else if (id <= 4 * n) {
    for (int i = 1; i <= id - 2 * n; i++) {
      ans += "C";
      swap(num[4 * n + 1], num[2 * n + 1]);
      for (int j = 2 * n + 1; j < 4 * n; j++) swap(num[j], num[j + 1]);
    }
  }
  for (;;) {
    int u = 0, v = 0;
    for (int i = 1; i <= 2 * n; i++) {
      if (num[i] > 2 * n) u = i;
      if (num[2 * n + i] <= 2 * n) v = 2 * n + i;
    }
    if (!u) break;
    if (u == 1)
      swap1(u, 2, v, n);
    else
      swap1(u, 1, v, n);
  }
  pair<int, int> a[70], b[70];
  bool vis[70];
  memset(vis, 0, sizeof(vis));
  int sz1 = 0, sz2 = 0;
  for (int i = 1; i <= 2 * n; i++)
    if (!vis[i]) {
      int x = i, cur[70], cnt = 0;
      do {
        cur[++cnt] = x;
        vis[x] = 1;
        x = num[x];
      } while (x != i);
      for (int j = cnt; j > 1; j--)
        a[++sz1] = pair<int, int>(cur[j - 1], cur[j]);
    }
  for (int i = 2 * n + 1; i <= 4 * n; i++)
    if (!vis[i]) {
      int x = i, cur[70], cnt = 0;
      do {
        cur[++cnt] = x;
        vis[x] = 1;
        x = num[x];
      } while (x != i);
      for (int j = cnt; j > 1; j--)
        b[++sz2] = pair<int, int>(cur[j - 1], cur[j]);
    }
  while (sz1 < sz2) a[++sz1] = pair<int, int>(1, 2);
  while (sz2 < sz1) b[++sz2] = pair<int, int>(2 * n + 1, 2 * n + 2);
  for (int i = 1; i <= sz1; i++) {
    swap1(a[i].first, a[i].second, b[i].second, n);
    swap2(b[i].second, b[i].first, a[i].second, n);
  }
  for (int i = 1; i <= n; i++) ans += "r";
}
int rd() {
  string s;
  cin >> s;
  if (s[0] == 'E') return 0;
  return atoi(s.c_str());
}
int b[70];
string cur;
bool check(int n) {
  cur.clear();
  int id = 0;
  for (int i = 1; i <= 4 * n + 2; i++)
    if (!b[i]) {
      id = i;
      break;
    }
  for (int i = 0; i < ans.size(); i++)
    if (ans[i] >= 'a' && ans[i] <= 'z')
      cur += ans[i];
    else if (ans[i] == 'A') {
      cur += "u";
      for (int i = 1; i <= n; i++) cur += "l";
      cur += "d";
      for (int i = 1; i <= n; i++) cur += "r";
    } else if (ans[i] == 'B') {
      for (int i = 1; i <= n; i++) cur += "l";
      cur += "u";
      for (int i = 1; i <= n; i++) cur += "r";
      cur += "d";
    } else if (ans[i] == 'C') {
      cur += "u";
      for (int i = 1; i <= n; i++) cur += "r";
      cur += "d";
      for (int i = 1; i <= n; i++) cur += "l";
    } else {
      for (int i = 1; i <= n; i++) cur += "r";
      cur += "u";
      for (int i = 1; i <= n; i++) cur += "l";
      cur += "d";
    }
  for (int i = 0; i < cur.length(); i++)
    if (cur[i] == 'l') {
      if (id == 1 || id == 2 * n + 2) return 0;
      swap(b[id], b[id - 1]);
      id--;
    } else if (cur[i] == 'r') {
      if (id == 2 * n + 1 || id == 4 * n + 2) return 0;
      swap(b[id], b[id + 1]);
      id++;
    } else if (cur[i] == 'u') {
      if (id != 2 * n + 2 && id != 3 * n + 2 && id != 4 * n + 2) return 0;
      swap(b[id], b[id - 2 * n - 1]);
      id -= 2 * n + 1;
    } else {
      if (id != 1 && id != n + 1 && id != 2 * n + 1) return 0;
      swap(b[id], b[id + 2 * n + 1]);
      id += 2 * n + 1;
    }
  for (int i = 1; i <= 4 * n + 1; i++)
    if (b[i] != i) return 0;
  return 1;
}
int main() {
  int cases;
  scanf("%d", &cases);
  for (; cases; cases--) {
    int n;
    scanf("%d", &n);
    for (int i = n; i > 0; i--) num[i] = rd();
    num[4 * n + 1] = rd();
    for (int i = 2 * n + 1; i <= 3 * n; i++) num[i] = rd();
    for (int i = n + 1; i <= 2 * n; i++) num[i] = rd();
    num[4 * n + 2] = rd();
    for (int i = 4 * n; i > 3 * n; i--) num[i] = rd();
    if (!init(n)) {
      puts("SURGERY FAILED");
      continue;
    }
    puts("SURGERY COMPLETE");
    solve(n);
    cout << ans << endl;
    gettrans(n);
    puts("DONE");
  }
  return 0;
}