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 int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const long long INF = 1e18;
const long double PI = 4 * atan((long double)1);
template <class T>
bool ckmin(T& a, const T& b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
namespace input {
template <class T>
void re(complex<T>& x);
template <class T1, class T2>
void re(pair<T1, T2>& p);
template <class T>
void re(vector<T>& a);
template <class T, size_t SZ>
void re(array<T, SZ>& a);
template <class T>
void re(T& x) {
  cin >> x;
}
void re(double& x) {
  string t;
  re(t);
  x = stod(t);
}
void re(long double& x) {
  string t;
  re(t);
  x = stold(t);
}
template <class T, class... Ts>
void re(T& t, Ts&... ts) {
  re(t);
  re(ts...);
}
template <class T>
void re(complex<T>& x) {
  T a, b;
  re(a, b);
  x = cd(a, b);
}
template <class T1, class T2>
void re(pair<T1, T2>& p) {
  re(p.first, p.second);
}
template <class T>
void re(vector<T>& a) {
  for (int i = (0); i < ((int)a.size()); ++i) re(a[i]);
}
template <class T, size_t SZ>
void re(array<T, SZ>& a) {
  for (int i = (0); i < (SZ); ++i) re(a[i]);
}
}  // namespace input
using namespace input;
namespace output {
void pr(int x) { cout << x; }
void pr(long x) { cout << x; }
void pr(long long x) { cout << x; }
void pr(unsigned x) { cout << x; }
void pr(unsigned long x) { cout << x; }
void pr(unsigned long long x) { cout << x; }
void pr(float x) { cout << x; }
void pr(double x) { cout << x; }
void pr(long double x) { cout << x; }
void pr(char x) { cout << x; }
void pr(const char* x) { cout << x; }
void pr(const string& x) { cout << x; }
void pr(bool x) { pr(x ? "true" : "false"); }
template <class T>
void pr(const complex<T>& x) {
  cout << x;
}
template <class T1, class T2>
void pr(const pair<T1, T2>& x);
template <class T>
void pr(const T& x);
template <class T, class... Ts>
void pr(const T& t, const Ts&... ts) {
  pr(t);
  pr(ts...);
}
template <class T1, class T2>
void pr(const pair<T1, T2>& x) {
  pr("{", x.first, ", ", x.second, "}");
}
template <class T>
void pr(const T& x) {
  pr("{");
  bool fst = 1;
  for (const auto& a : x) pr(!fst ? ", " : "", a), fst = 0;
  pr("}");
}
void ps() { pr("\n"); }
template <class T, class... Ts>
void ps(const T& t, const Ts&... ts) {
  pr(t);
  if (sizeof...(ts)) pr(" ");
  ps(ts...);
}
void pc() { pr("]\n"); }
template <class T, class... Ts>
void pc(const T& t, const Ts&... ts) {
  pr(t);
  if (sizeof...(ts)) pr(", ");
  pc(ts...);
}
}  // namespace output
using namespace output;
namespace io {
void setIn(string second) { freopen(second.c_str(), "r", stdin); }
void setOut(string second) { freopen(second.c_str(), "w", stdout); }
void setIO(string second = "") {
  cin.sync_with_stdio(0);
  cin.tie(0);
  if ((int)second.size()) {
    setIn(second + ".in"), setOut(second + ".out");
  }
}
}  // namespace io
using namespace io;
typedef decay<decltype(MOD)>::type T;
struct mi {
  T val;
  explicit operator T() const { return val; }
  mi() { val = 0; }
  mi(const long long& v) {
    val = (-MOD <= v && v <= MOD) ? v : v % MOD;
    if (val < 0) val += MOD;
  }
  friend void pr(const mi& a) { pr(a.val); }
  friend void re(mi& a) {
    long long x;
    re(x);
    a = mi(x);
  }
  friend bool operator==(const mi& a, const mi& b) { return a.val == b.val; }
  friend bool operator!=(const mi& a, const mi& b) { return !(a == b); }
  friend bool operator<(const mi& a, const mi& b) { return a.val < b.val; }
  mi operator-() const { return mi(-val); }
  mi& operator+=(const mi& m) {
    if ((val += m.val) >= MOD) val -= MOD;
    return *this;
  }
  mi& operator-=(const mi& m) {
    if ((val -= m.val) < 0) val += MOD;
    return *this;
  }
  mi& operator*=(const mi& m) {
    val = (long long)val * m.val % MOD;
    return *this;
  }
  friend mi pow(mi a, long long p) {
    mi ans = 1;
    assert(p >= 0);
    for (; p; p /= 2, a *= a)
      if (p & 1) ans *= a;
    return ans;
  }
  friend mi inv(const mi& a) {
    assert(a != 0);
    return pow(a, MOD - 2);
  }
  mi& operator/=(const mi& m) { return (*this) *= inv(m); }
  friend mi operator+(mi a, const mi& b) { return a += b; }
  friend mi operator-(mi a, const mi& b) { return a -= b; }
  friend mi operator*(mi a, const mi& b) { return a *= b; }
  friend mi operator/(mi a, const mi& b) { return a /= b; }
};
int k, R, g[2][31];
pair<int, int> pos;
string ans;
void prin() {
  for (int i = (0); i < (2); ++i) {
    for (int j = (0); j < (R); ++j) pr(g[i][j], ' ');
    ps();
  }
  ps("-------");
}
void upMov() {
  assert(pos.first == 1 && pos.second % k == 0);
  swap(g[pos.first][pos.second], g[pos.first - 1][pos.second]);
  pos.first--;
}
void up() {
  upMov();
  ans += 'u';
}
void downMov() {
  assert(pos.first == 0 && pos.second % k == 0);
  swap(g[pos.first][pos.second], g[pos.first + 1][pos.second]);
  pos.first++;
}
void down() {
  downMov();
  ans += 'd';
}
void leftMov() {
  assert(pos.second);
  swap(g[pos.first][pos.second], g[pos.first][pos.second - 1]);
  pos.second--;
}
void left() {
  leftMov();
  ans += 'l';
}
void rightMov() {
  assert(pos.second < R - 1);
  swap(g[pos.first][pos.second], g[pos.first][pos.second + 1]);
  pos.second++;
}
void right() {
  rightMov();
  ans += 'r';
}
void gor() {
  if (pos == make_pair(1, 0))
    up();
  else if (pos == make_pair(0, R - 1))
    down();
  else if (pos.first == 1)
    left();
  else
    right();
}
void ROT() {
  ans += 'B';
  for (int i = (0); i < (k); ++i) leftMov();
  upMov();
  for (int i = (0); i < (R - 1); ++i) rightMov();
  downMov();
  for (int i = (0); i < (k); ++i) leftMov();
}
void ROT2() {
  ans += 'C';
  for (int i = (0); i < (k); ++i) leftMov();
  downMov();
  for (int i = (0); i < (R - 1); ++i) rightMov();
  upMov();
  for (int i = (0); i < (k); ++i) leftMov();
}
void RIGHT(int x) {
  while (pos != make_pair(1, k)) gor();
  while (g[0][k] != x) ROT();
  up();
}
void LEFT(int x) {
  while (pos != make_pair(0, k)) gor();
  while (g[1][k] != x) ROT2();
  down();
}
void rmap() {
  for (int i = (0); i < (2); ++i)
    for (int j = (0); j < (R); ++j)
      if (g[i][j] > R) g[i][j] = 3 * R - g[i][j];
}
string tmp, rot, rot2;
bool done() {
  for (int i = (0); i < (R); ++i)
    if (g[0][i] != i + 1) return 0;
  int cnt = R;
  for (int i = (R)-1; i >= (0); --i)
    if (i != k) {
      cnt++;
      if (g[1][i] != cnt) return 0;
    }
  return 1;
}
void solve() {
  re(k);
  R = 2 * k + 1;
  ans = tmp = rot = rot2 = "";
  int cnt = 0;
  for (int j = (0); j < (R); ++j) g[0][j] = ++cnt;
  for (int j = (R)-1; j >= (0); --j)
    if (j != k) g[1][j] = ++cnt;
  pos = {1, k};
  RIGHT(1);
  RIGHT(1);
  RIGHT(2);
  LEFT(3);
  LEFT(2);
  LEFT(3);
  while (g[0][0] != 2 || pos != make_pair(1, k)) gor();
  swap(tmp, ans);
  for (int i = (0); i < (2); ++i) {
    for (int j = (0); j < (R); ++j) {
      string second;
      re(second);
      if (second == "E") {
        g[i][j] = 0;
        pos = {i, j};
      } else
        g[i][j] = stoi(second);
    }
  }
  while (pos.second < R - 1) right();
  if (pos.first == 0) down();
  int inv = 0;
  for (int i = (0); i < (2 * R - 1); ++i)
    for (int j = (i + 1); j < (2 * R - 1); ++j) {
      if (g[i / R][i % R] > g[j / R][j % R]) inv++;
    }
  if (inv & 1) {
    ps("SURGERY FAILED");
    return;
  }
  while (pos.second > k) left();
  rmap();
  for (int i = (0); i < (k); ++i) rot += 'l';
  rot += 'u';
  for (int i = (0); i < (R - 1); ++i) rot += 'r';
  rot += 'd';
  for (int i = (0); i < (k); ++i) rot += 'l';
  rot2 = rot;
  for (auto& t : rot2) {
    if (t == 'u')
      t = 'd';
    else if (t == 'd')
      t = 'u';
  }
  while (!done()) {
    ROT();
    if (g[0][0] != 2 * R - 1 && g[0][1] != 2 * R - 1 && g[0][2] != 2 * R - 1) {
      while (g[0][0] > min(g[0][1], g[0][2])) {
        swap(g[0][0], g[0][1]);
        swap(g[0][1], g[0][2]);
        ans += 'A';
      }
    }
  }
  rmap();
  while (pos.second < R - 1) right();
  ps("SURGERY COMPLETE");
  ps(ans);
  ps("A", tmp);
  ps("B", rot);
  ps("C", rot2);
  ps("DONE");
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  int t;
  re(t);
  for (int i = (0); i < (t); ++i) solve();
}