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;
template <typename T>
void debug_out(T t) {
  cerr << t;
}
template <typename A, typename B>
void debug_out(pair<A, B> u) {
  cerr << "(" << u.first << " " << u.second << ")";
}
template <typename T>
void debug_out(vector<T> t) {
  int sz = t.size();
  for (int i = 0; i < sz; i++) {
    debug_out(t[i]);
    if (i != sz - 1) cerr << ", ";
  }
}
template <typename T>
void debug_out(vector<vector<T>> t) {
  int sz = t.size();
  for (int i = 0; i < sz; i++) {
    debug_out(t[i]);
    if (i != sz - 1) cerr << endl;
  }
}
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  debug_out(H);
  cerr << " ";
  debug_out(T...);
}
long long to_num(string t) {
  long long res = 0;
  for (int i = 0; i < (int)t.length(); i++) {
    res *= 10;
    res += t[i] - '0';
  }
  return res;
}
int tt;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> tt;
  while (tt--) {
    int n;
    cin >> n;
    vector<vector<int>> a(2, vector<int>(2 * n + 1));
    pair<int, int> st;
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2 * n + 1; j++) {
        string s;
        cin >> s;
        if (s == "E")
          a[i][j] = 0;
        else
          a[i][j] = to_num(s);
        if (s == "E") st = make_pair(i, j);
      }
    }
    vector<int> ip;
    for (int i = 0; i < 2 * n + 1; i++)
      if (a[0][i]) ip.push_back(a[0][i]);
    for (int i = 0; i < 2 * n + 1; i++)
      if (a[1][i]) ip.push_back(a[1][i]);
    int cnt = 0;
    for (int i = 0; i < 4 * n + 1; i++) {
      for (int j = 0; j < i; j++) {
        cnt += ip[j] > ip[i];
      }
    }
    if (cnt & 1) {
      cout << "SURGERY FAILED" << endl;
      continue;
    }
    string res;
    while (st.second != n) {
      if (st.second > n) {
        res.push_back('l');
        swap(a[st.first][st.second - 1], a[st.first][st.second]);
        st.second--;
      } else {
        res.push_back('r');
        swap(a[st.first][st.second + 1], a[st.first][st.second]);
        st.second++;
      }
    }
    if (st.first < 1) {
      res.push_back('d');
      swap(a[st.first + 1][st.second], a[st.first][st.second]);
      st.first++;
    }
    string A, B, C, D;
    A += 'u';
    for (int i = 0; i < n; i++) A += 'l';
    A += 'd';
    for (int i = 0; i < n; i++) A += 'r';
    B += 'u';
    for (int i = 0; i < n; i++) B += 'r';
    B += 'd';
    for (int i = 0; i < n; i++) B += 'l';
    for (int i = 0; i < n; i++) C += 'r';
    C += 'u';
    for (int i = 0; i < n; i++) C += 'l';
    C += 'd';
    for (int i = 0; i < n; i++) D += 'l';
    D += 'u';
    for (int i = 0; i < n; i++) D += 'r';
    D += 'd';
    map<char, string> sc;
    sc['A'] = A;
    sc['B'] = B;
    sc['C'] = C;
    sc['D'] = D;
    string E = "CDBBAC";
    string F = "DCAABD";
    string G = "ABDDCA";
    string H = "BACCDB";
    sc['E'] = E;
    sc['F'] = F;
    sc['G'] = G;
    sc['H'] = H;
    string S = "CDBABDCABDCACDBA";
    string R = "DCABACDBACDBDCAB";
    sc['S'] = S;
    sc['R'] = R;
    function<void(string)> go = [&](string s) {
      for (char x : s) {
        if ('A' <= x && x <= 'Z') {
          go(sc[x]);
          continue;
        }
        int u = st.first, v = st.second;
        if (x == 'l') st.second--;
        if (x == 'r') st.second++;
        if (x == 'u') st.first--;
        if (x == 'd') st.first++;
        swap(a[u][v], a[st.first][st.second]);
      }
    };
    set<int> ft;
    for (int i = 1; i < n + 1; i++) ft.insert(i);
    for (int i = 2 * n + 2; i < 3 * n + 2; i++) ft.insert(i);
    while (true) {
      int change = 0;
      for (int i = 0; i < 2; i++) {
        for (int j = 0; j < n; j++) {
          change += ft.find(a[i][j]) == ft.end();
        }
      }
      if (!change) break;
      while (ft.find(a[0][n]) == ft.end()) {
        res += 'B';
        go(B);
      }
      while (ft.find(a[0][n]) != ft.end()) {
        res += 'D';
        go(D);
      }
    }
    while (a[0][n] != n + 1) {
      res += 'B';
      go(B);
    }
    vector<int> to(4 * n + 2, -1);
    auto next = [&](pair<int, int> u, bool lf) {
      int x = u.first, y = u.second;
      if (!lf) {
        if (x == 0) {
          if (y == n) {
            x++;
            y--;
          } else {
            y++;
          }
        } else {
          if (y > 0)
            y--;
          else {
            x--;
          }
        }
      } else {
        if (x == 0) {
          if (y == 2 * n) {
            x++;
          } else
            y++;
        } else {
          if (y == n + 1) {
            x--;
          }
          y--;
        }
      }
      return make_pair(x, y);
    };
    auto calc = [&](bool lf) {
      int it = (lf ? n + 1 : 1);
      pair<int, int> pt;
      for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2 * n + 1; j++) {
          if (a[i][j] == it) pt = make_pair(i, j);
        }
      }
      vector<int> cur;
      while ((int)cur.size() < 2 * n + 1) {
        cur.push_back(a[pt.first][pt.second]);
        pt = next(pt, lf);
      }
      int cc = 0;
      for (int i = 0; i < 2 * n + 1; i++) {
        for (int j = 0; j < i; j++) {
          cc += to[cur[j]] > to[cur[i]];
        }
      }
      return cc;
    };
    for (int i = 1; i < n + 2; i++) to[i] = i - 1;
    for (int i = 3 * n + 1; i > 2 * n + 1; i--) to[i] = n + 1 + 3 * n + 1 - i;
    while (true) {
      int ini = calc(false);
      if (!ini) {
        while (a[0][n] != n + 1) {
          res += 'D';
          go(D);
        }
        break;
      }
      for (int i = 0; i < 2 * n + 1; i++) {
        res += 'D';
        go(D);
        swap(a[1][n - 1], a[0][n]);
        int cpp = calc(false);
        swap(a[1][n - 1], a[0][n]);
        if (cpp < ini) {
          res += 'S';
          go(S);
          ini = cpp;
        }
      }
    }
    fill(to.begin(), to.end(), -1);
    for (int i = n + 1; i < 2 * n + 2; i++) to[i] = i - n - 1;
    for (int i = 4 * n + 1; i > 3 * n + 1; i--) to[i] = n + 1 + 4 * n + 1 - i;
    while (true) {
      int ini = calc(true);
      if (!ini) {
        while (a[0][n] != n + 1) {
          res += 'C';
          go(C);
        }
        break;
      }
      for (int i = 0; i < 2 * n + 1; i++) {
        res += 'C';
        go(C);
        swap(a[1][n + 1], a[0][n]);
        int cpp = calc(true);
        swap(a[1][n + 1], a[0][n]);
        if (cpp < ini) {
          res += 'R';
          go(R);
          ini = cpp;
        }
      }
    }
    while (n--) {
      res += 'r';
      go("r");
    }
    cout << "SURGERY COMPLETE" << endl;
    cout << res << endl;
    cout << "R " << R << endl;
    cout << "S " << S << endl;
    cout << "E " << E << endl;
    cout << "F " << F << endl;
    cout << "G " << G << endl;
    cout << "H " << H << endl;
    cout << "A " << A << endl;
    cout << "B " << B << endl;
    cout << "C " << C << endl;
    cout << "D " << D << endl;
    cout << "DONE" << endl;
  }
  return 0;
}