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 const N = 31;
int x[2][N], n, m, a, b, d, cl[N << 1];
char ins[5];
vector<pair<char, string> > dc;
string an;
void pr() {
  for (int i = 0; i < (int)(2); ++i) {
    for (int j = 0; j < (int)(n); ++j) printf("%d ", x[i][j]);
    printf("\n");
  }
}
void gol(bool pr = false) {
  if (pr) an += 'l';
  swap(x[a][b], x[a][b - 1]);
  --b;
}
void gor(bool pr = false) {
  if (pr) an += 'r';
  swap(x[a][b], x[a][b + 1]);
  ++b;
}
void gou(bool pr = false) {
  if (pr) an += 'u';
  swap(x[a][b], x[a - 1][b]);
  --a;
}
void god(bool pr = false) {
  if (pr) an += 'd';
  swap(x[a][b], x[a + 1][b]);
  ++a;
}
void go(string const &s) {
  for (int i = 0; i < (int)(s.size()); ++i) switch (s[i]) {
      case 'l':
        gol();
        break;
      case 'r':
        gor();
        break;
      case 'u':
        gou();
        break;
      case 'd':
        god();
        break;
    }
}
void go(int t) {
  an += dc[t].first;
  go(dc[t].second);
}
void RL() {
  an += 'A';
  int t = x[1][m + 1];
  x[1][m + 1] = x[0][m];
  x[0][m] = x[0][m - 1];
  x[0][m - 1] = t;
}
void RR() {
  an += 'K';
  int t = x[1][m - 1];
  x[1][m - 1] = x[0][m];
  x[0][m] = x[0][m + 1];
  x[0][m + 1] = t;
}
void SL() {
  an += 'Z';
  int t = n == 3 ? x[1][0] : x[0][m - 2];
  (n == 3 ? x[1][0] : x[0][m - 2]) = x[0][m - 1];
  x[0][m - 1] = x[0][m];
  ;
  x[0][m] = t;
}
void SR() {
  an += 'M';
  int t = n == 3 ? x[1][2] : x[0][m + 2];
  (n == 3 ? x[1][2] : x[0][m + 2]) = x[0][m + 1];
  x[0][m + 1] = x[0][m];
  x[0][m] = t;
}
void BC(int tp, int v) {
  while (x[1 ^ tp >> 1][m + (tp & 1 ? 1 : -1)] != v) go(tp);
}
void klr(int v, int a, int b) {
  while (x[a][b] != v) {
    BC(3, v);
    if (x[0][m] == n + d) go(3);
    SR();
    BC(1, n + d);
  }
}
void kll(int v, int a, int b) {
  while (x[a][b] != v) {
    BC(2, v);
    if (x[0][m] == n + d - 1) go(2);
    SL();
    BC(0, n + d - 1);
  }
}
char mp(char c) {
  switch (c) {
    case 'L':
      return 'X';
    case 'R':
      return 'C';
    case 'P':
      return 'V';
    case 'Q':
      return 'B';
  }
}
void cmp(string &s) {
  string an;
  for (int i = 0; i < (int)(s.size()); ++i)
    if (s[i] == 'L' || s[i] == 'R' || s[i] == 'P' || s[i] == 'Q') {
      int j = i;
      while (j + 1 < s.size() && s[j + 1] == s[j]) ++j;
      int d = j - i + 1;
      while (d >= 5) {
        d -= 5;
        an += mp(s[i]);
      }
      while (d) an += s[i], --d;
      i = j;
    } else
      an += s[i];
  swap(an, s);
}
void solve() {
  scanf("%d", &n);
  n = n << 1 | 1;
  for (int i = 0; i < (int)(2); ++i)
    for (int j = 0; j < (int)(n); ++j) {
      scanf("%s", ins);
      if (ins[0] == 'E')
        x[i][j] = 0, a = i, b = j;
      else
        x[i][j] = atoi(ins);
    }
  m = n >> 1;
  d = m + 1;
  an.clear();
  dc.clear();
  string t;
  for (int i = 0; i < (int)(m); ++i) t += 'l';
  t += 'u';
  for (int i = 0; i < (int)(m); ++i) t += 'r';
  t += 'd';
  dc.emplace_back('L', t);
  t.clear();
  for (int i = 0; i < (int)(m); ++i) t += 'r';
  t += 'u';
  for (int i = 0; i < (int)(m); ++i) t += 'l';
  t += 'd';
  dc.emplace_back('R', t);
  t.clear();
  t += 'u';
  for (int i = 0; i < (int)(m); ++i) t += 'l';
  t += 'd';
  for (int i = 0; i < (int)(m); ++i) t += 'r';
  dc.emplace_back('Q', t);
  t.clear();
  t += 'u';
  for (int i = 0; i < (int)(m); ++i) t += 'r';
  t += 'd';
  for (int i = 0; i < (int)(m); ++i) t += 'l';
  dc.emplace_back('P', t);
  dc.emplace_back('A', "RQPLRQPL");
  dc.emplace_back('K', "LPQRLPQR");
  dc.emplace_back('Z', "AQALAQAL");
  dc.emplace_back('M', "KPKRKPKR");
  dc.emplace_back('X', "LLLLL");
  dc.emplace_back('C', "RRRRR");
  dc.emplace_back('V', "PPPPP");
  dc.emplace_back('B', "QQQQQ");
  for (int i = 1; i < (int)(d); ++i) cl[i] = 1;
  cl[d] = 0;
  for (int i = d + 1; i < (int)(n + 1); ++i) cl[i] = 2;
  for (int i = n + 1; i < (int)(n + d); ++i) cl[i] = 1;
  for (int i = n + d; i < (int)(n << 1); ++i) cl[i] = 2;
  while (b > m) gol(true);
  while (b < m) gor(true);
  if (a == 0) god(true);
  for (int i = 0; i < (int)(2); ++i)
    for (int j = 0; j < (int)(m); ++j)
      if (x[i][j] == d)
        while (x[0][m] != d) go(0);
  for (int i = 0; i < (int)(2); ++i)
    for (int j = m + 1; j < (int)(n); ++j)
      if (x[i][j] == d)
        while (x[0][m] != d) go(1);
  while (true) {
    bool ok = false;
    for (int i = 0; i < (int)(2); ++i)
      for (int j = m + 1; j < (int)(n); ++j)
        if (!ok && cl[x[i][j]] == 1) {
          ok = true;
          BC(1, x[i][j]);
          break;
        }
    if (!ok) break;
    go(1);
    while (cl[x[0][m]] == 1) go(0);
    while (x[0][m] != d) go(3);
  }
  BC(1, n + d);
  for (int i = n + d + 1; i < (int)(n << 1); ++i) klr(i, 1, i - n);
  for (int i = n; i > d + 1; --i) klr(i, 0, i - 1);
  if (x[0][m] != d) RR(), RR();
  BC(0, n + d - 1);
  for (int i = n + d - 2; i > n; --i) kll(i, 1, i - n - 1);
  for (int i = 1; i < (int)(d - 1); ++i) kll(i, 0, i - 1);
  if (x[0][m] != d) {
    printf("SURGERY FAILED\n");
    return;
  }
  for (int i = 0; i < (int)(m); ++i) gor(true);
  cmp(an);
  printf("SURGERY COMPLETE\n%s\n", an.c_str());
  for (auto &s : dc) printf("%c %s\n", s.first, s.second.c_str());
  printf("DONE\n");
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
}