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 t;
int k, g[2][31];
bool dumb;
int R;
pair<int, int> pos;
string ans;
void left(bool b = 1) {
  if (dumb) {
    ans += 'l';
    return;
  }
  assert(pos.second > 0);
  swap(g[pos.first][pos.second], g[pos.first][pos.second - 1]);
  pos.second--;
  if (b) ans += 'l';
}
void right(bool b = 1) {
  if (dumb) {
    ans += 'r';
    return;
  }
  assert(pos.second < R - 1);
  swap(g[pos.first][pos.second], g[pos.first][pos.second + 1]);
  pos.second++;
  if (b) ans += 'r';
}
void down(bool b = 1) {
  if (dumb) {
    ans += 'd';
    return;
  }
  assert(pos.first == 0 && pos.second % k == 0);
  swap(g[pos.first][pos.second], g[pos.first + 1][pos.second]);
  pos.first++;
  if (b) ans += 'd';
}
void up(bool b = 1) {
  if (dumb) {
    ans += 'u';
    return;
  }
  assert(pos.first == 1 && pos.second % k == 0);
  swap(g[pos.first][pos.second], g[pos.first - 1][pos.second]);
  pos.first--;
  if (b) ans += 'u';
}
void prin() {
  for (int i = (0); i < (2); ++i) {
    for (int j = (0); j < (R); ++j) pr(g[i][j], ' ');
    ps();
  }
  ps("-------");
}
bool range(int x, int l, int r) { return l <= x && x <= r; }
void label() {
  for (int i = (0); i < (2); ++i) {
    for (int j = (0); j < (R); ++j) {
      if (g[i][j] == 0) continue;
      if (range(g[i][j], 2 * k + 2, 3 * k + 1))
        g[i][j] = 3 * k + 2 - g[i][j];
      else if (range(g[i][j], 1, 2 * k + 1))
        g[i][j] += k;
      else if (range(g[i][j], 3 * k + 2, 4 * k + 1))
        g[i][j] = 7 * k + 3 - g[i][j];
    }
  }
}
void rlabel() {
  for (int i = (0); i < (2); ++i) {
    for (int j = (0); j < (R); ++j) {
      if (g[i][j] == 0) continue;
      if (range(g[i][j], 1, k))
        g[i][j] = 3 * k + 2 - g[i][j];
      else if (range(g[i][j], k + 1, 3 * k + 1))
        g[i][j] -= k;
      else if (range(g[i][j], 3 * k + 2, 4 * k + 1))
        g[i][j] = 7 * k + 3 - g[i][j];
    }
  }
}
void rotL(bool b = 0) {
  if (!b) assert(pos.first == 1 && pos.second == k);
  up(b);
  for (int i = (0); i < (k); ++i) left(b);
  down(b);
  for (int i = (0); i < (k); ++i) right(b);
  if (!b) assert(pos.first == 1 && pos.second == k);
  if (!b) ans += "A";
}
void rotLrev(bool b = 0) {
  if (!b) assert(pos.first == 1 && pos.second == k);
  for (int i = (0); i < (k); ++i) left(b);
  up(b);
  for (int i = (0); i < (k); ++i) right(b);
  down(b);
  if (!b) assert(pos.first == 1 && pos.second == k);
  if (!b) ans += "B";
}
void rotR(bool b = 0) {
  if (!b) assert(pos.first == 1 && pos.second == k);
  up(b);
  for (int i = (0); i < (k); ++i) right(b);
  down(b);
  for (int i = (0); i < (k); ++i) left(b);
  if (!b) assert(pos.first == 1 && pos.second == k);
  if (!b) ans += "C";
}
void rotRrev(bool b = 0) {
  if (!b) assert(pos.first == 1 && pos.second == k);
  for (int i = (0); i < (k); ++i) right(b);
  up(b);
  for (int i = (0); i < (k); ++i) left(b);
  down(b);
  if (!b) assert(pos.first == 1 && pos.second == k);
  if (!b) ans += "D";
}
void solve() {
  ans = "";
  dumb = 0;
  re(k);
  R = 2 * k + 1;
  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();
  while (pos.first < 1) 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;
  }
  ps("SURGERY COMPLETE");
  label();
  for (int i = (0); i < (k); ++i) left();
  for (int z = (0); z < (4 * R); ++z) {
    if (g[0][k] <= 2 * k + 1)
      rotL();
    else
      rotR();
  }
  for (int i = (0); i < (2); ++i)
    for (int j = (0); j < (R); ++j) {
      if (j < k)
        assert(g[i][j] <= 2 * k + 1);
      else if (j > k)
        assert(g[i][j] > 2 * k + 1);
    }
  for (int i = (0); i < (R * R); ++i) {
    if (g[0][k - 1] > g[0][k] && g[0][k - 1] != R) {
      rotR();
      rotL();
      rotRrev();
      rotLrev();
      rotR();
    }
    rotL();
  }
  while (g[0][k] != R) rotL();
  bool first = 0;
  for (int i = (0); i < (R * R); ++i) {
    if (g[0][k] != 2 * R - 1 && g[0][k] > g[0][k + 1]) {
      first ? rotL() : rotLrev();
      rotR();
      first ? rotLrev() : rotL();
      rotRrev();
      first ? rotL() : rotLrev();
      first ^= 1;
    }
    rotR();
  }
  assert(!first);
  while (g[0][k] != R) rotR();
  rlabel();
  for (int i = (0); i < (k); ++i) right();
  ps(ans);
  dumb = 1;
  ans = "";
  rotL(1);
  ps("A", ans);
  ans = "";
  rotLrev(1);
  ps("B", ans);
  ans = "";
  rotR(1);
  ps("C", ans);
  ans = "";
  rotRrev(1);
  ps("D", ans);
  ps("DONE");
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  re(t);
  for (int i = (0); i < (t); ++i) solve();
}