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;
const double pi = acos(0.0) * 2.0;
const long double eps = 1e-10;
const int step[8][2] = {{-1, 0}, {0, 1}, {1, 0},  {0, -1},
                        {-1, 1}, {1, 1}, {1, -1}, {-1, -1}};
template <class T>
inline T abs1(T a) {
  return a < 0 ? -a : a;
}
template <typename t, typename t1>
t min1(t a, t1 b) {
  return a < b ? a : b;
}
template <typename t, typename... arg>
t min1(t a, arg... arr) {
  return min1(a, min1(arr...));
}
template <typename t, typename t1>
t max1(t a, t1 b) {
  return a > b ? a : b;
}
template <typename t, typename... arg>
t max1(t a, arg... arr) {
  return max1(a, max1(arr...));
}
inline int jud(double a, double b) {
  if (abs(a) < eps && abs(b) < eps)
    return 0;
  else if (abs1(a - b) / max(abs1(a), abs1(b)) < eps)
    return 0;
  if (a < b) return -1;
  return 1;
}
template <typename t>
inline int jud(t a, t b) {
  if (a < b) return -1;
  if (a == b) return 0;
  return 1;
}
template <typename it, typename t1>
inline int find(t1 val, it a, int na, bool f_small = 1, bool f_lb = 1) {
  if (na == 0) return 0;
  int be = 0, en = na - 1;
  if (*a <= *(a + na - 1)) {
    if (f_lb == 0)
      while (be < en) {
        int mid = (be + en + 1) / 2;
        if (jud(*(a + mid), val) != 1)
          be = mid;
        else
          en = mid - 1;
      }
    else
      while (be < en) {
        int mid = (be + en) / 2;
        if (jud(*(a + mid), val) != -1)
          en = mid;
        else
          be = mid + 1;
      }
    if (f_small && jud(*(a + be), val) == 1) be--;
    if (!f_small && jud(*(a + be), val) == -1) be++;
  } else {
    if (f_lb)
      while (be < en) {
        int mid = (be + en + 1) / 2;
        if (jud(*(a + mid), val) != -1)
          be = mid;
        else
          en = mid - 1;
      }
    else
      while (be < en) {
        int mid = (be + en) / 2;
        if (jud(*(a + mid), val) != 1)
          en = mid;
        else
          be = mid + 1;
      }
    if (!f_small && jud(*(a + be), val) == -1) be--;
    if (f_small && jud(*(a + be), val) == 1) be++;
  }
  return be;
}
template <class T>
inline T lowb(T num) {
  return num & (-num);
}
inline int bitnum(unsigned int nValue) { return __builtin_popcount(nValue); }
inline int bitnum(int nValue) { return __builtin_popcount(nValue); }
inline int bitnum(unsigned long long nValue) {
  return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32);
}
inline int bitnum(long long nValue) {
  return __builtin_popcount(nValue) + __builtin_popcount(nValue >> 32);
}
inline int bitmaxl(unsigned int a) {
  if (a == 0) return 0;
  return 32 - __builtin_clz(a);
}
inline int bitmaxl(int a) {
  if (a == 0) return 0;
  return 32 - __builtin_clz(a);
}
inline int bitmaxl(unsigned long long a) {
  int temp = a >> 32;
  if (temp) return 32 - __builtin_clz(temp) + 32;
  return bitmaxl(int(a));
}
inline int bitmaxl(long long a) {
  int temp = a >> 32;
  if (temp) return 32 - __builtin_clz(temp) + 32;
  return bitmaxl(int(a));
}
long long pow(long long n, long long m, long long mod = 0) {
  if (m < 0) return 0;
  long long ans = 1;
  long long k = n;
  while (m) {
    if (m & 1) {
      ans *= k;
      if (mod) ans %= mod;
    }
    k *= k;
    if (mod) k %= mod;
    m >>= 1;
  }
  return ans;
}
template <class t1, class t2>
inline void add(t1& a, t2 b, int mod = -1) {
  if (mod == -1) mod = 1000000007;
  a += b;
  while (a >= mod) a -= mod;
  while (a < 0) a += mod;
}
template <class t>
void output1(t arr) {
  for (int i = 0; i < (int)arr.size(); i++) cerr << arr[i] << ' ';
  cerr << endl;
}
template <class t>
void output2(t arr) {
  for (int i = 0; i < (int)arr.size(); i++) output1(arr[i]);
}
const int maxn = 33;
int ncase;
vector<vector<int> > arr;
char str[30];
int n;
int x, y;
string rot[20];
void Apply(const string& str);
void Apply(char ch) {
  if (ch == 'u') {
    if (x == 1 && y % n == 0) {
      swap(arr[x][y], arr[x - 1][y]);
      x--;
    } else {
      cerr << "Invalid co " << x << ' ' << y << " for op u" << endl;
      assert(0);
    }
  } else if (ch == 'd') {
    if (x == 0 && y % n == 0) {
      swap(arr[x][y], arr[x + 1][y]);
      x++;
    } else {
      cerr << "Invalid co " << x << ' ' << y << " for op d" << endl;
      assert(0);
    }
  } else if (ch == 'l') {
    if (y > 0) {
      swap(arr[x][y], arr[x][y - 1]);
      y--;
    } else {
      cerr << "Invalid co " << x << ' ' << y << " for op l" << endl;
      assert(0);
    }
  } else if (ch == 'l') {
    if (y > 0) {
      swap(arr[x][y], arr[x][y - 1]);
      y--;
    } else {
      cerr << "Invalid co " << x << ' ' << y << " for op l" << endl;
      assert(0);
    }
  } else if (ch == 'r') {
    if (y < 2 * n) {
      swap(arr[x][y], arr[x][y + 1]);
      y++;
    } else {
      cerr << "Invalid co " << x << ' ' << y << " for op r" << endl;
      assert(0);
    }
  } else
    Apply(rot[ch - 'A']);
}
void Apply(const string& str) {
  for (auto ch : str) {
    Apply(ch);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  scanf("%d", &ncase);
  bool flag = 0;
  for (int i1 = 0; i1 < ncase; i1++) {
    scanf("%d", &n);
    rot[0] = "";
    for (int i = 0; i < n; i++) {
      rot[0] += "r";
    }
    rot[0] += "u";
    for (int i = 0; i < 2 * n; i++) {
      rot[0] += "l";
    }
    rot[0] += "d";
    for (int i = 0; i < n; i++) {
      rot[0] += "r";
    }
    rot[1] = "";
    for (int i = 0; i < n; i++) {
      rot[1] += "l";
    }
    rot[1] += "u";
    for (int i = 0; i < 2 * n; i++) {
      rot[1] += "r";
    }
    rot[1] += "d";
    for (int i = 0; i < n; i++) {
      rot[1] += "l";
    }
    rot[2] = "u";
    for (int i = 0; i < n; i++) {
      rot[2] += "l";
    }
    rot[2] += "d";
    for (int i = 0; i < n; i++) {
      rot[2] += "r";
    }
    rot[3] = "";
    for (int i = 0; i < n; i++) {
      rot[3] += "l";
    }
    rot[3] += "u";
    for (int i = 0; i < n; i++) {
      rot[3] += "r";
    }
    rot[3] += "d";
    rot[5] = "u";
    for (int i = 0; i < n; i++) {
      rot[5] += "r";
    }
    rot[5] += "d";
    for (int i = 0; i < n; i++) {
      rot[5] += "l";
    }
    rot[4] = "";
    for (int i = 0; i < n; i++) {
      rot[4] += "r";
    }
    rot[4] += "u";
    for (int i = 0; i < n; i++) {
      rot[4] += "l";
    }
    rot[4] += "d";
    rot[6] = "CFFDAED";
    arr = {{}, {}};
    arr[0].resize(n * 2 + 1);
    arr[1].resize(n * 2 + 1);
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2 * n + 1; j++) {
        scanf("%s", str);
        if (i1 == 3 && flag) {
          printf("%s ", str);
        }
        if (str[0] == 'E') {
          arr[i][j] = -1;
          x = i, y = j;
        } else {
          sscanf(str, "%d", &arr[i][j]);
          if (arr[i][j] > n * 2 + 1) {
            arr[i][j] = n * 2 + 2 + n * 4 + 1 - arr[i][j];
          }
        }
      }
      if (i1 == 3 && flag) {
        puts("");
      }
    }
    string ans = "";
    while (y < n) {
      ans += "r";
      Apply('r');
    }
    while (y > n) {
      ans += "l";
      Apply('l');
    }
    if (x == 0) {
      ans += "d";
      Apply('d');
    }
    for (int i = 1; i < 6; i++) {
      rot[i + 6] = string(1 << i, 'B');
    }
    for (int i = 2; i < n * 4; i++) {
      while (true) {
        int cnt = 0;
        while (arr[0][n + 1] != i) {
          Apply(rot[1]);
          cnt++;
        }
        if (cnt & 1) ans += "B";
        for (int i = 1; i < 6; i++) {
          if (cnt & (1 << i)) {
            ans += char(i + 6 + 'A');
          }
        }
        if (arr[0][n] == i - 1)
          break;
        else {
          int nxt = arr[1][n + 1];
          if (n + 2 < 2 * n + 1) nxt = arr[0][n + 2];
          if (nxt > i) {
            Apply(rot[6]);
            ans += 'G';
          } else {
            Apply(rot[0]);
            ans += 'A';
            Apply(rot[6]);
            ans += 'G';
          }
        }
      }
    }
    while (arr[0][0] != 1) {
      Apply(rot[1]);
      ans += "B";
    }
    for (int i = 0; i < n; i++) {
      Apply('r');
      ans += "r";
    }
    if (!flag) {
      if (arr[1][0] != n * 4 + 1) {
        cout << "SURGERY FAILED" << endl;
      } else {
        cout << "SURGERY COMPLETE" << endl;
        cout << ans << endl;
        for (int i = 0; i < 12; i++) {
          cout << char('A' + i) << ' ' << rot[i] << endl;
        }
        cout << "DONE" << endl;
      }
    }
  }
  return 0;
}