import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.algorithm;

struct seg
{
    int l = int.max;
    int r;
}

bool ask(int r, int c, int r1, int c1)
{
    writefln("? %d %d %d %d", r, c, r1, c1);
    stdout.flush;
    return "YES" == readln.chomp;
}

void main()
{
    int n;
    readf("%d\n", &n);
    bool[] a;
    a.length = 2 * n - 2;
    int r = 1, c = 1;
    foreach (i; 0..n - 1) {
        ++r;
        a[i] = ask(r, c, n, n);
        if (!a[i]) {
            --r;
            ++c;
        }
    }
    r = c = n;
    foreach (i; 1..n) {
        --c;
        a[$ - i] = !ask(1, 1, r, c);
        if (a[$ - i]) {
            ++c;
            --r;
        }
    }
    write("! ");
    foreach (down; a) {
        write(down ? 'D' : 'R');
    }
    writeln;
    stdout.flush;
}

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable int INF = 1 << 29;

bool ask(int r1, int c1, int r2, int c2) {
    if (r1 > r2 && c2 > c1) return false;
    if (r2 > r1 && c1 > c2) return false;
    if (r1 > r2 || c1 > c2) swap(r1, r2), swap(c1, c2);
    writeln("? ", r1+1, " ", c1+1, " ", r2+1, " ", c2+1);
    stdout.flush;
    return readln.chomp == "YES";
}

int dist(int r1, int c1, int r2, int c2) {
    return abs(r1 - r2) + abs(c1 - c2);
}

void main() {
    auto N = readln.chomp.to!int;
    Tuple!(int, int)[] ans = [tuple(0, 0)];
    Tuple!(int, int)[] ans2 = [tuple(N-1, N-1)];

    for (int r = 0, c = 0; dist(r, c, N-1, N-1) >= N; ) {
        if (ask(r+1, c, N-1, N-1)) {
            ++r;
        } else {
            ++c;
        }
        ans ~= tuple(r, c);
    }

    for (int r = N-1, c = N-1, p = ans.length.to!int-2; r != ans.back[0] || c != ans.back[1]; --p) {
        if (r == ans.back[0]) {
            --c;
        } else if (c == ans.back[1]) {
            --r;
        } else if (ask(r, c-1, ans[p][0], ans[p][1])) {
            --c;
        } else {
            --r;
        }
        ans2 ~= tuple(r, c);
    }

    ans2.reverse;
    ans = ans ~ ans2;
    string ans_s = "! ";

    foreach (i; 0..ans.length.to!int-1) {
        int r1 = ans[i][0];
        int c1 = ans[i][1];
        int r2 = ans[i+1][0];
        int c2 = ans[i+1][1];
        if (r1 == r2 && c1 == c2) continue;
        if (r1 != r2) ans_s ~= "D";
        else ans_s ~= "R";
    }

    writeln(ans_s);
    stdout.flush;
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

bool ask (int row1, int col1, int row2, int col2)
{
	writeln ("? ", row1, " ", col1, " ", row2, " ", col2);
	stdout.flush ();
	auto res = readln.strip;
	return (res == "YES");
}

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		readln;

		int [2] [] a;
		{
			int row1 = 1;
			int col1 = 1;
			int row2 = n;
			int col2 = n;
			a ~= [row1, col1];
			foreach (step; 0..n - 1)
			{
				row1 += 1;
				if (!ask (row1, col1, row2, col2))
				{
					row1 -= 1;
					col1 += 1;
				}
				a ~= [row1, col1];
			}
		}

		int [2] [] b;
		{
			int row1 = 1;
			int col1 = 1;
			int row2 = n;
			int col2 = n;
			b ~= [row2, col2];
			foreach (step; 0..n - 1)
			{
				col2 -= 1;
				if (!ask (row1, col1, row2, col2))
				{
					col2 += 1;
					row2 -= 1;
				}
				b ~= [row2, col2];
			}
		}

		assert (a.back == b.back);
		auto c = a ~ b.retro.drop (1).array;
		write ("! ");
		foreach (i; 1..c.length)
		{
			write ((c[i][0] == c[i - 1][0]) ? 'R' : 'D');
		}
		writeln;
		stdout.flush ();
	}
}

import core.bitop;
import std.algorithm;
import std.array;
import std.bitmanip;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.range.interfaces;

void main()
{
    int n;
    readf("%s", &n);
    readln;

    auto currw = 1, curcol = 1;
    dchar[] anspref;
    foreach (_; 0 .. n-1) {
        writeln(format("? %s %s %s %s", currw, curcol+1, n, n));
        stdout.flush();

        auto msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anspref ~= 'R';
            curcol += 1;
        } else {
            anspref ~= 'D';
            currw += 1;
        }
    }

    dchar[] anssuf;
    currw = n, curcol = n;
    foreach (_; 0 .. n-1) {
        writeln(format("? 1 1 %s %s", currw-1, curcol));
        stdout.flush();

        auto msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anssuf ~= 'D';
            currw -= 1;
        } else {
            anssuf ~= 'R';
            curcol -= 1;
        }
    }
    reverse(anssuf);

    auto ans = anspref ~ anssuf;

    writeln("! ", ans);
    stdout.flush();
}

import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

int N;
debug {
  string[] A;
}

bool Ask(int x0, int y0, int x1, int y1) {
  assert((x1 - x0) + (y1 - y0) >= N - 1);
  bool ret;
  debug {
    if (A[x0][y0] == '.' && A[x1][y1] == '.') {
      auto dp = new bool[][](N, N);
      dp[x0][y0] = true;
      foreach (x; 0 .. N) foreach (y; 0 .. N) {
        if (dp[x][y]) {
          if (x + 1 < N && A[x + 1][y] == '.') {
            dp[x + 1][y] = true;
          }
          if (y + 1 < N && A[x][y + 1] == '.') {
            dp[x][y + 1] = true;
          }
        }
      }
      ret = dp[x1][y1];
      writefln("Ask %s %s %s %s = %s", x0, y0, x1, y1, ret);
    } else {
      ret = false;
    }
  } else {
    writefln("? %s %s %s %s", x0 + 1, y0 + 1, x1 + 1, y1 + 1);
    stdout.flush;
    ret = (readToken() == "YES");
  }
  return ret;
}

void main() {
  N = readInt();
  debug {
    A = new string[N];
    foreach (x; 0 .. N) {
      A[x] = readToken();
    }
  }

  auto diagS = new bool[N];
  auto diagT = new bool[N];
  foreach (x; 0 .. N) {
    diagS[x] = Ask(0, 0, x, N - 1 - x);
    diagT[x] = Ask(x, N - 1 - x, N - 1, N - 1);
  }
  int xm = -1;
  foreach (x; 0 .. N) {
    if (diagS[x] && diagT[x]) {
      xm = x;
      break;
    }
  }
  debug {
    writeln("diagS = ", diagS);
    writeln("diagT = ", diagT);
    writeln("xm = ", xm);
  }

  string ansS, ansT;
  for (int x = 0, y = 0; !(x == xm && y == N - 1 - xm); ) {
    if (y + 1 <= N - 1 - xm && Ask(x, y + 1, N - 1, N - 1)) {
      ++y;
      ansS = ansS ~ 'R';
    } else {
      ++x;
      ansS = ansS ~ 'D';
    }
  }
  for (int x = N - 1, y = N - 1; !(x == xm && y == N - 1 - xm); ) {
    if (x - 1 >= xm && Ask(0, 0, x - 1, y)) {
      --x;
      ansT = 'D' ~ ansT;
    } else {
      --y;
      ansT = 'R' ~ ansT;
    }
  }

  writefln("! %s%s", ansS, ansT);
  stdout.flush;
}

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable int INF = 1 << 29;

bool ask(int r1, int c1, int r2, int c2) {
    if (r1 > r2 && c2 > c1) return false;
    if (r2 > r1 && c1 > c2) return false;
    if (r1 > r2 || c1 > c2) swap(r1, r2), swap(c1, c2);
    writeln("? ", r1+1, " ", c1+1, " ", r2+1, " ", c2+1);
    stdout.flush;
    return readln.chomp == "YES";
}

int dist(int r1, int c1, int r2, int c2) {
    return abs(r1 - r2) + abs(c1 - c2);
}

void main() {
    auto N = readln.chomp.to!int;
    Tuple!(int, int)[] ans = [tuple(0, 0)];
    Tuple!(int, int)[] ans2 = [tuple(N-1, N-1)];

    for (int r = 0, c = 0; dist(r, c, N-1, N-1) >= N; ) {
        if (ask(r+1, c, N-1, N-1)) {
            ++r;
        } else {
            ++c;
        }
        ans ~= tuple(r, c);
    }

    for (int r = N-1, c = N-1, p = ans.length.to!int-2; r != ans.back[0] || c != ans.back[1]; --p) {
        if (r == ans.back[0]) {
            --c;
        } else if (c == ans.back[1]) {
            --r;
        } else if (ask(r-1, c, ans[p][0], ans[p][1])) {
            --r;
        } else {
            --c;
        }
        ans2 ~= tuple(r, c);
    }

    ans2.reverse;
    ans = ans ~ ans2;
    string ans_s = "! ";

    foreach (i; 0..ans.length.to!int-1) {
        int r1 = ans[i][0];
        int c1 = ans[i][1];
        int r2 = ans[i+1][0];
        int c2 = ans[i+1][1];
        if (r1 == r2 && c1 == c2) continue;
        if (r1 != r2) ans_s ~= "D";
        else ans_s ~= "R";
    }

    writeln(ans_s);
    stdout.flush;
}

import core.bitop;
import std.algorithm;
import std.array;
import std.bitmanip;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.range.interfaces;

void main()
{
    int n;
    readf("%s", &n);
    readln;

    int rw = 1;
    foreach (x; 1 .. n+1) {
        writeln(format("? 1 1 %s %s", x, n+1 - x));
        stdout.flush();

        auto msg1 = readln.chomp;

        if (msg1 == "BAD") return;

        writeln(format("? %s %s %s %s", x, n+1 - x, n, n));
        stdout.flush();

        auto msg2 = readln.chomp;

        if (msg2 == "BAD") return;

        if (msg1 == "YES" && msg2 == "YES") {
            rw = x;
            break;
        }
    }

    dchar[] anssuf;
    int currw = rw, curcol = n+1 - rw;
    foreach (_; 0 .. n-1) {
        if (curcol + 1 > n) {
            anssuf ~= 'D';
            continue;
        }

        writeln(format("? 1 1 %s %s", currw, curcol+1));
        stdout.flush();

        auto msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anssuf ~= 'R';
            curcol += 1;
        } else {
            anssuf ~= 'D';
            currw += 1;
        }
    }

    currw = rw, curcol = n+1 - rw;
    dchar[] anspref;
    foreach (_; 0 .. n-1) {
        if (currw == 1) {
            anspref ~= 'R';
            continue;
        }

        writeln(format("? %s %s %s %s", currw-1, curcol, n, n));
        stdout.flush();

        auto msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anspref ~= 'D';
            currw -= 1;
        } else {
            anspref ~= 'R';
            curcol -= 1;
        }
    }
    reverse(anspref);

    auto ans = anspref ~ anssuf;

    writeln("! ", ans);
    stdout.flush();
}

import core.bitop;
import std.algorithm;
import std.array;
import std.bitmanip;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.range.interfaces;

void main()
{
    int n;
    readf("%s", &n);
    readln;

    string msg;
    int rw = 1;
    foreach (x; 1 .. n+1) {
        writeln(format("? 1 1 %s %s", x, n+1 - x));
        stdout.flush();

        msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            rw = x;
            break;
        }
    }

    dchar[] anssuf;
    int currw = rw, curcol = n+1 - rw;
    foreach (_; 0 .. n-1) {
        if (currw + 1 > n) {
            anssuf ~= 'R';
            continue;
        }

        writeln(format("? 1 1 %s %s", currw+1, curcol));
        stdout.flush();

        msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anssuf ~= 'D';
            currw += 1;
        } else {
            anssuf ~= 'R';
            curcol += 1;
        }
    }

    currw = rw, curcol = n+1 - rw;
    dchar[] anspref;
    foreach (_; 0 .. n-1) {
        if (currw == 1) {
            anspref ~= 'R';
            continue;
        }

        writeln(format("? %s %s %s %s", currw-1, curcol, n, n));
        stdout.flush();

        msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anspref ~= 'D';
            currw -= 1;
        } else {
            anspref ~= 'R';
            curcol -= 1;
        }
    }
    reverse(anspref);

    auto ans = anspref ~ anssuf;

    writeln("! ", ans);
    stdout.flush();
}

import core.bitop;
import std.algorithm;
import std.array;
import std.bitmanip;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.range.interfaces;

void main()
{
    int n;
    readf("%s", &n);
    readln;

    string msg;
    int rw = 1;
    foreach (x; 1 .. n+1) {
        writeln(format("? 1 1 %s %s", x, n+1 - x));
        stdout.flush();

        msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            rw = x;
            break;
        }
    }

    dchar[] anssuf;
    int currw = rw, curcol = n+1 - rw;
    foreach (_; 0 .. n-1) {
        if (currw + 1 > n) {
            anssuf ~= 'R';
            continue;
        }

        writeln(format("? 1 1 %s %s", currw+1, curcol));
        stdout.flush();

        msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anssuf ~= 'D';
            currw += 1;
        } else {
            anssuf ~= 'R';
            curcol += 1;
        }
    }

    currw = rw, curcol = n+1 - rw;
    dchar[] anspref;
    foreach (_; 0 .. n-1) {
        if (currw == 1) {
            anspref ~= 'R';
            continue;
        }

        writeln(format("? %s %s %s %s", currw-1, curcol, n, n));
        stdout.flush();

        msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anspref ~= 'D';
            currw -= 1;
        } else {
            anspref ~= 'R';
            curcol -= 1;
        }
    }
    reverse(anspref);

    auto ans = anspref ~ anssuf;

    ans.writeln;
}

import core.bitop;
import std.algorithm;
import std.array;
import std.bitmanip;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.range.interfaces;

void main()
{
    int n;
    readf("%s", &n);
    readln;

    int rw = 1;
    foreach (x; 1 .. n+1) {
        writeln(format("? 1 1 %s %s", x, n+1 - x));
        stdout.flush();

        auto msg1 = readln.chomp;

        if (msg1 == "BAD") return;

        writeln(format("? %s %s %s %s", x, n+1 - x, n, n));
        stdout.flush();

        auto msg2 = readln.chomp;

        if (msg2 == "BAD") return;

        if (msg1 == "YES" && msg2 == "YES") {
            rw = x;
            break;
        }
    }

    dchar[] anssuf;
    int currw = rw, curcol = n+1 - rw;
    foreach (_; 0 .. n-1) {
        if (currw + 1 > n) {
            anssuf ~= 'R';
            continue;
        }

        writeln(format("? 1 1 %s %s", currw+1, curcol));
        stdout.flush();

        auto msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anssuf ~= 'D';
            currw += 1;
        } else {
            anssuf ~= 'R';
            curcol += 1;
        }
    }

    currw = rw, curcol = n+1 - rw;
    dchar[] anspref;
    foreach (_; 0 .. n-1) {
        if (curcol == 1) {
            anspref ~= 'D';
            continue;
        }

        writeln(format("? %s %s %s %s", currw, curcol-1, n, n));
        stdout.flush();

        auto msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anspref ~= 'R';
            curcol -= 1;
        } else {
            anspref ~= 'D';
            currw -= 1;
        }
    }
    reverse(anspref);

    auto ans = anspref ~ anssuf;

    writeln("! ", ans);
    stdout.flush();
}

import core.bitop;
import std.algorithm;
import std.array;
import std.bitmanip;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.range.interfaces;

void main()
{
    int n;
    readf("%s", &n);
    readln;

    auto currw = 1, curcol = 1;
    dchar[] anspref;
    foreach (_; 0 .. n-1) {
        writeln(format("? %s %s %s %s", currw, curcol+1, n, n));
        stdout.flush();

        auto msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anspref ~= 'R';
            curcol -= 1;
        } else {
            anspref ~= 'D';
            currw -= 1;
        }
    }

    dchar[] anssuf;
    currw = n, curcol = n;
    foreach (_; 0 .. n-1) {
        writeln(format("? 1 1 %s %s", currw-1, curcol));
        stdout.flush();

        auto msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anssuf ~= 'D';
            currw += 1;
        } else {
            anssuf ~= 'R';
            curcol += 1;
        }
    }
    reverse(anssuf);

    auto ans = anspref ~ anssuf;

    writeln("! ", ans);
    stdout.flush();
}

import core.bitop;
import std.algorithm;
import std.array;
import std.bitmanip;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.range.interfaces;

void main()
{
    int n;
    readf("%s", &n);
    readln;

    string msg;
    int rw = 1;
    foreach (x; 1 .. n+1) {
        writeln(format("? 1 1 %s %s", x, n+1 - x));
        stdout.flush();

        auto msg1 = readln.chomp;

        if (msg1 == "BAD") return;

        writeln(format("? %s %s %s %s", x, n+1 - x, n, n));
        stdout.flush();

        auto msg2 = readln.chomp;

        if (msg2 == "BAD") return;

        if (msg1 == "YES" && msg2 == "YES") {
            rw = x;
            break;
        }
    }

    dchar[] anssuf;
    int currw = rw, curcol = n+1 - rw;
    foreach (_; 0 .. n-1) {
        if (currw + 1 > n) {
            anssuf ~= 'R';
            continue;
        }

        writeln(format("? 1 1 %s %s", currw+1, curcol));
        stdout.flush();

        msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anssuf ~= 'D';
            currw += 1;
        } else {
            anssuf ~= 'R';
            curcol += 1;
        }
    }

    currw = rw, curcol = n+1 - rw;
    dchar[] anspref;
    foreach (_; 0 .. n-1) {
        if (currw == 1) {
            anspref ~= 'R';
            continue;
        }

        writeln(format("? %s %s %s %s", currw-1, curcol, n, n));
        stdout.flush();

        msg = readln.chomp;

        if (msg == "BAD") return;

        if (msg == "YES") {
            anspref ~= 'D';
            currw -= 1;
        } else {
            anspref ~= 'R';
            curcol -= 1;
        }
    }
    reverse(anspref);

    auto ans = anspref ~ anssuf;

    writeln("! ", ans);
    stdout.flush();
}

import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.algorithm;

struct seg
{
    int l = int.max;
    int r;
}

bool ask(int r, int c, int r1, int c1)
{
    writefln("? %d %d %d %d", r, c, r1, c1);
    stdout.flush;
    return "YES" == readln.chomp;
}

void main()
{
    int n;
    readf("%d\n", &n);
    bool[] a;
    a.length = 2 * n - 2;
    int r = 1, c = 1;
    foreach (i; 0..n - 1) {
        ++r;
        a[i] = ask(r, c, n, n);
        if (!a[i]) {
            --r;
            ++c;
        }
    }
    r = c = n;
    foreach (i; 1..n) {
        --c;
        a[$ - i] = !ask(1, 1, r, c);
        if (a[$ - i]) {
            ++c;
            --r;
        }
    }
    foreach (down; a) {
        write(down ? 'D' : 'R');
    }
    writeln;
    stdout.flush;
}

import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

int N;
debug {
  string[] A;
}

int Ask(int x0, int y0, int x1, int y1) {
  bool ret;
  debug {
    if (A[x0][y0] == '.' && A[x1][y1] == '.') {
      auto dp = new bool[][](N, N);
      dp[x0][y0] = true;
      foreach (x; 0 .. N) foreach (y; 0 .. N) {
        if (dp[x][y]) {
          if (x + 1 < N && A[x + 1][y] == '.') {
            dp[x + 1][y] = true;
          }
          if (y + 1 < N && A[x][y + 1] == '.') {
            dp[x][y + 1] = true;
          }
        }
      }
      ret = dp[x1][y1];
    } else {
      ret = false;
    }
  } else {
    writefln("? %s %s %s %s", x0 + 1, y0 + 1, x1 + 1, y1 + 1);
    stdout.flush;
    ret = (readToken() == "YES");
  }
  return ret;
}

void main() {
  N = readInt();
  debug {
    A = new string[N];
    foreach (x; 0 .. N) {
      A[x] = readToken();
    }
  }

  string ans;
  for (int x = 0, y = 0; !(x == N - 1 && y == N - 1); ) {
    if (x + y + 1 <= N - 1) {
      if (x + 1 < N && Ask(x + 1, y, N - 1, N - 1)) {
        ++x;
        ans ~= 'D';
      } else {
        ++y;
        ans ~= 'R';
      }
    } else {
      if (x + 1 < N && Ask(0, 0, x + 1, y)) {
        ++x;
        ans ~= 'D';
      } else {
        ++y;
        ans ~= 'R';
      }
    }
  }
  writefln("! %s", ans);
  stdout.flush;
}


import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

void main() {
  try {
    for (; ; ) {
      const N = readInt();
      auto A = new string[N];
      auto B = new int[N];
      foreach (i; 0 .. N) {
        A[i] = readToken();
        B[i] = readInt();
      }

      bool[string] app;
      foreach (i; 0 .. N) {
        app[A[i]] = true;
      }
      string dummy;
      for (int a = 10^^5 + 1; ; ++a) {
        if (a.to!string !in app) {
          dummy = a.to!string;
          break;
        }
      }

      const E = B.sum;
      auto ss = new string[N];
      int[string] tr;
      foreach (u; 0 .. N) {
        ss[u] = (u + 1).to!string;
        tr[ss[u]] = u;
      }

      // 0: vacant, 1: done, 2: need change
      auto status = new int[N];
      auto iss = new int[][2];
      foreach (i; 0 .. N) {
        if (A[i] in tr) {
          const u = tr[A[i]];
          status[u] = ((B[i] == 1) == (u < E)) ? 1 : 2;
        } else {
          iss[B[i]] ~= i;
        }
      }
      debug {
        writeln("status = ", status);
        writeln("iss = ", iss);
      }

      auto vacant = new DList!int[2];
      auto change = new DList!int[2];
      foreach (u; 0 .. N) {
        const b = (u < E) ? 1 : 0;
        if (status[u] == 0) vacant[b] ~= u;
        if (status[u] == 2) change[b] ~= u;
      }

      string[][] ans;
      int b0 = -1;

      if (vacant[0].empty && vacant[1].empty) {
        foreach (b; 0 .. 2) {
          if (!change[b].empty) {
            const u = change[b].back;
            change[b].removeBack;
            vacant[b] ~= u;
            ans ~= [ss[u], dummy];
            b0 = b;
            break;
          }
        }
      }

      for (; ; ) {
        bool upd;
        foreach (b; 0 .. 2) {
          if (!change[b].empty) {
            const u = change[b].back;
            if (!vacant[b ^ 1].empty) {
              const v = vacant[b ^ 1].back;
              change[b].removeBack;
              vacant[b ^ 1].removeBack;
              vacant[b] ~= u;
              ans ~= [ss[u], ss[v]];
              upd = true;
              break;
            }
          }
        }
        if (!upd) {
          break;
        }
      }

      if (b0 != -1) {
        assert(!vacant[b0 ^ 1].empty);
        const v = vacant[b0 ^ 1].back;
        vacant[b0 ^ 1].removeBack;
        ans ~= [dummy, ss[v]];
      }

      foreach (b; 0 .. 2) {
        foreach (i; iss[b]) {
          assert(!vacant[b].empty);
          const v = vacant[b].back;
          vacant[b].removeBack;
          ans ~= [A[i], ss[v]];
        }
      }

      writeln(ans.length);
      foreach (row; ans) {
        writeln("move ", row[0], " ", row[1]);
      }
    }
  } catch (EOFException e) {
  }
}

import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		readln;
		auto name = new string [n];
		auto isExample = new bool [n];
		foreach (i; 0..n)
		{
			auto t = readln.split;
			name[i] = t[0];
			isExample[i] = t[1].to !(int).to !(bool);
		}

		bool [string] [2] p;
		foreach (i; 0..n)
		{
			p[!isExample[i]][name[i]] = true;
		}
		int examples = isExample.sum;

		string [] [4] [2] e;
		string temp = "";
		string tempDefault = (n + 1).text;
		foreach (num; 1..examples + 1)
		{
			auto str = num.text;
			if (str in p[0])
			{
				e[0][0] ~= str;
				p[0][str] = false;
			}
			else if (str in p[1])
			{
				e[1][1] ~= str;
				p[1][str] = false;
			}
			else
			{
				e[0][3] ~= str;
				temp = str;
			}
		}
		foreach (num; examples + 1..n + 1)
		{
			auto str = num.text;
			if (str in p[1])
			{
				e[1][0] ~= str;
				p[1][str] = false;
			}
			else if (str in p[0])
			{
				e[0][1] ~= str;
				p[0][str] = false;
			}
			else
			{
				e[1][3] ~= str;
				temp = str;
			}
		}
		if (temp == "")
		{
			temp = tempDefault;
		}
		assert (temp != "" && !name.canFind (temp));
		foreach (k, v; p[0])
		{
			if (v)
			{
				e[0][2] ~= k;
			}
		}
		foreach (k, v; p[1])
		{
			if (v)
			{
				e[1][2] ~= k;
			}
		}

		string [] [] ans;
		while (!e[0][1].empty || !e[0][2].empty ||
		    !e[1][1].empty || !e[1][2].empty)
		{
			debug {writefln ("%(%s\n%)\n%s", e, temp);}
			if (e[0][3].empty && e[1][3].empty)
			{
				assert (temp == tempDefault);
				if (!e[0][1].empty)
				{
					ans ~= [e[0][1].front, temp];
					e[0][2].assumeSafeAppend ();
					e[0][2] ~= temp;
					e[1][3].assumeSafeAppend ();
					e[1][3] ~= e[0][1].front;
					e[0][1].popFront ();
				}
				else if (!e[1][1].empty)
				{
					ans ~= [e[1][1].front, temp];
					e[1][2].assumeSafeAppend ();
					e[1][2] ~= temp;
					e[0][3].assumeSafeAppend ();
					e[0][3] ~= e[1][1].front;
					e[1][1].popFront ();
				}
				else
				{
					assert (false);
				}
			}
			else
			{
				if (!e[0][3].empty)
				{
					if (!e[0][1].empty)
					{
						ans ~= [e[0][1].front,
						    e[0][3].front];
						e[0][0].assumeSafeAppend ();
						e[0][0] ~= e[0][3].front;
						e[1][3].assumeSafeAppend ();
						e[1][3] ~= e[0][1].front;
						e[0][1].popFront ();
						e[0][3].popFront ();
					}
					else
					{
						ans ~= [e[0][2].front,
						    e[0][3].front];
						e[0][0].assumeSafeAppend ();
						e[0][0] ~= e[0][3].front;
						e[0][2].popFront ();
						e[0][3].popFront ();
					}
				}
				else if (!e[1][3].empty)
				{
					if (!e[1][1].empty)
					{
						ans ~= [e[1][1].front,
						    e[1][3].front];
						e[1][0].assumeSafeAppend ();
						e[1][0] ~= e[1][3].front;
						e[0][3].assumeSafeAppend ();
						e[0][3] ~= e[1][1].front;
						e[1][1].popFront ();
						e[1][3].popFront ();
					}
					else
					{
						ans ~= [e[1][2].front,
						    e[1][3].front];
						e[1][0].assumeSafeAppend ();
						e[1][0] ~= e[1][3].front;
						e[1][2].popFront ();
						e[1][3].popFront ();
					}
				}
				else
				{
					assert (false);
				}
	        	}
		}
		debug {writefln ("%(%s\n%)\n%s", e, temp);}

		writeln (ans.length);
		foreach (c; ans)
		{
			writefln ("move %-(%s %)", c);
		}
	}
}


import core.bitop;
import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

immutable int mod = 10 ^^ 9 + 7;
immutable int limit = 32;

void add (ref int a, int b)
{
	a += b;
	if (a >= mod)
	{
		a -= mod;
	}
}

void main ()
{
	int n;
	while (readf !(" %s") (n) > 0)
	{
		readln;
		auto a = readln.splitter.map !(to !(int)).array;
		auto c = new int [limit];
		foreach (ref x; a)
		{
			c[x.bsf] += 1;
		}

		auto p2 = [1];
		while (p2.length <= n)
		{
			p2 ~= (p2.back << 1) % mod;
		}

		int bads = 0;
		int k = n - c[0];
		foreach (i; 1..limit)
		{
			if (c[i] > 0)
			{
				auto cur = p2[k - 1];
				add (bads, cur);
				k -= c[i];
			}
		}

		int res = p2[n];
		add (res, mod - 1 - bads);
		writeln (res);
	}
}

import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

struct ModInt(uint M_) {
  import std.conv : to;
  alias M = M_;
  uint x;
  this(ModInt a) { x = a.x; }
  this(uint x_) { x = x_ % M; }
  this(ulong x_) { x = x_ % M; }
  this(int x_) { x = ((x_ %= cast(int)(M)) < 0) ? (x_ + cast(int)(M)) : x_; }
  this(long x_) { x = cast(uint)(((x_ %= cast(long)(M)) < 0) ? (x_ + cast(long)(M)) : x_); }
  ref ModInt opAssign(T)(inout(T) a) if (is(T == uint) || is(T == ulong) || is(T == int) || is(T == long)) { return this = ModInt(a); }
  ref ModInt opOpAssign(string op, T)(T a) {
    static if (is(T == ModInt)) {
      static if (op == "+") { x = ((x += a.x) >= M) ? (x - M) : x; }
      else static if (op == "-") { x = ((x -= a.x) >= M) ? (x + M) : x; }
      else static if (op == "*") { x = cast(uint)((cast(ulong)(x) * a.x) % M); }
      else static if (op == "/") { this *= a.inv(); }
      else static assert(false);
      return this;
    } else static if (op == "^^") {
      if (a < 0) return this = inv()^^(-a);
      ModInt b = this, c = 1U;
      for (long e = a; e; e >>= 1) { if (e & 1) c *= b; b *= b; }
      return this = c;
    } else {
      return mixin("this " ~ op ~ "= ModInt(a)");
    }
  }
  ModInt inv() const {
    uint a = M, b = x; int y = 0, z = 1;
    for (; b; ) { const q = a / b; const c = a - q * b; a = b; b = c; const w = y - cast(int)(q) * z; y = z; z = w; }
    assert(a == 1); return ModInt(y);
  }
  ModInt opUnary(string op)() const {
    static if (op == "+") { return this; }
    else static if (op == "-") { ModInt a; a.x = x ? (M - x) : 0U; return a; }
    else static assert(false);
  }
  ModInt opBinary(string op, T)(T a) const { return mixin("ModInt(this) " ~ op ~ "= a"); }
  ModInt opBinaryRight(string op, T)(T a) const { return mixin("ModInt(a) " ~ op ~ "= this"); }
  bool opCast(T: bool)() const { return (x != 0U); }
  string toString() const { return x.to!string; }
}

enum MO = 10^^9 + 7;
alias Mint = ModInt!MO;

enum LIM = 4 * 10^^5 + 10;
Mint[] inv, fac, invFac;
void prepare() {
  inv = new Mint[LIM];
  fac = new Mint[LIM];
  invFac = new Mint[LIM];
  inv[1] = 1;
  foreach (i; 2 .. LIM) {
    inv[i] = -((Mint.M / i) * inv[cast(size_t)(Mint.M % i)]);
  }
  fac[0] = invFac[0] = 1;
  foreach (i; 1 .. LIM) {
    fac[i] = fac[i - 1] * i;
    invFac[i] = invFac[i - 1] * inv[i];
  }
}
Mint binom(long n, long k) {
  if (n < 0) {
    if (k >= 0) {
      return (-1)^^(k & 1) * binom(-n + k - 1, k);
    } else if (n - k >= 0) {
      return (-1)^^((n - k) & 1) * binom(-k - 1, n - k);
    } else {
      return Mint(0);
    }
  } else {
    if (0 <= k && k <= n) {
      assert(n < LIM);
      return fac[cast(size_t)(n)] * invFac[cast(size_t)(k)] * invFac[cast(size_t)(n - k)];
    } else {
      return Mint(0);
    }
  }
}

enum E = 30;

void main() {
  prepare;
  try {
    for (; ; ) {
      const N = readInt();
      auto A = new int[N];
      foreach (i; 0 .. N) {
        A[i] = readInt();
      }

      auto cnt = new int[E];
      foreach (i; 0 .. N) {
        ++cnt[bsf(A[i])];
      }

      Mint ans = Mint(2)^^N;
      ans -= 1;
      foreach (e; 1 .. E) {
        if (cnt[e] > 0) {
          int sum = cnt[e] - 1;
          foreach (f; e + 1 .. E) {
            sum += cnt[f];
          }
          ans -= Mint(2)^^sum;
        }
      }
      writeln(ans);
    }
  } catch (EOFException e) {
  }
}

// 提出解
const long p = 1_000_000_007;
void solve(){
	int n = scan!int;
	long[] as = scan!long(n);

	int[] cnt = new int[](100);
	foreach(a; as){
		int c = 0;
		long x = a;
		while(x % 2 == 0) x /= 2, c += 1;
		cnt[c] += 1;
	}
	log("cnt:", cnt);

	long[] pow2 = [1];
	foreach(i; 0 .. n + 1) pow2 ~= pow2[$ - 1] * 2 % p;
	log("pow2:", pow2);

	long[] inv = [0, 1];
	foreach(i; 2 .. n + 1) inv ~= inv[p % i] * (p - p / i) % p;
	log("inv:", inv);

	long[] perm = [1, 1], invperm = [1, 1];
	foreach(i; 2 .. n + 1){
		perm ~= perm[$ - 1] * i % p;
		invperm ~= invperm[$ - 1] * inv[i] % p;
	}
	log("perm:", perm);
	log("invperm:", invperm);

	int left = n;
	long ans;

	long f(int x){
		long res;
		if(x == 0) return 0;
		else res = pow2[x] * inv[2] % p;
		res += p - 1, res %= p;
		log("res:", res);
		return res;
	}

	ans += (pow2[cnt[0]] + p - 1) % p * pow2[left -= cnt[0]] % p, ans %= p;
	log("i: 0", "ans:", ans);

	foreach(i; 1 .. 100){
		ans += f(cnt[i]) * pow2[left -= cnt[i]] % p, ans %= p;
		log("i:", i, "ans:", ans);
	}

	ans.print;
}

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
// 愚直解
void jury(){
}

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
// テストケース
void gen(){
}

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
// テンプレ
import std;
bool DEBUG = 0;
void main(string[] args){
	if(args.canFind("-debug")) DEBUG = 1;
	if(args.canFind("-gen")) gen; else if(args.canFind("-jury")) jury; else solve;
}
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); }
void print(T)(T t){ writeln(t); }
void print(T, A ...)(T t, A a){ stdout.write(t, " "), print(a); }
string unsplit(T)(T xs, string d = " "){ return xs.array.to!(string[]).join(d); }
string scan(){
	static string[] ss; while(!ss.length) ss = readln.chomp.split;
	string res = ss[0]; ss.popFront; return res;
}
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T mini(T)(ref T x, T y){ if(x > y) x = y; return x; }
T maxi(T)(ref T x, T y){ if(x < y) x = y; return x; }
T mid(T)(T l, T r, bool delegate(T) f){
	T m = (l + r) / 2; (f(m)? l: r) = m; return f(l)? f(r - 1)? r: mid(l, r, f): l;
}

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
// ライブラリ（基本）

class UnionFind{
	this(int n){ foreach(i; 0 .. n) R ~= i, K ~= [i]; } int[] R; int[][] K;
	void unite(int a, int b){
		int ra = R[a], rb = R[b]; if(ra == rb) return;
		if(K[ra].length < K[rb].length) unite(b, a);
		else foreach(k; K[rb]) R[k] = ra, K[ra] ~= k;
	}
	int find(int a){ return R[a]; }
	int getSize(int a){ return K[R[a]].length.to!int; }
}
class Queue(T){
	private T[] xs; private uint i, j;
	this(T[] xs = []){ this.xs = xs; j = xs.length.to!uint; }
	uint length(){ return j - i; }
	bool isEmpty(){ return j == i; }
	void enq(T x){ while(j + 1 >= xs.length) xs.length = xs.length * 2 + 1; xs[j ++] = x; }
	T deq(){ assert(i < j); return xs[i ++]; }
	T peek(){ assert(i < j); return xs[i]; }
	void flush(){ i = j; }
	alias empty = isEmpty, front = peek, popFront = deq, pop = deq, push = enq, top = peek;
	Queue opOpAssign(string op)(T x) if(op == "~"){ enq(x); return this; }
	T opIndex(uint li){ assert(i + li < j); return xs[i + li]; }
	static Queue!T opCall(T[] xs){ return new Queue!T(xs); }
	T[] array(){ return xs[i .. j]; }
	override string toString(){ return array.to!string; }
}
class Stack(T){
	private T[] xs; private uint j;
	this(T[] xs = []){ this.xs = xs; j = xs.length.to!uint; }
	uint length(){ return j; }
	bool isEmpty(){ return j == 0; }
	void push(T x){ while(j + 1 >= xs.length) xs.length = xs.length * 2 + 1; xs[j ++] = x; }
	T pop(){ assert(j > 0); return xs[-- j]; }
	T peek(){ assert(j > 0); return xs[j - 1]; }
	void clear(){ j = 0; }
	alias empty = isEmpty, front = peek, popFront = pop, top = peek;
	Stack opOpAssign(string op)(T x) if(op == "~"){ push(x); return this; }
	T opIndex(uint li){ assert(j > 0 && j - 1 >= li); return xs[j - 1 - li]; }
	static Stack!T opCall(T[] xs = []){ return new Stack!T(xs); }
	T[] array(){ return xs[0 .. j]; }
	override string toString(){ return array.to!string; }
}

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //
// ライブラリ（追加）


import std.algorithm, std.array, std.container, std.conv, std.math, std.numeric, std.random, std.range, std.stdio, std.string, std.typecons, core.bitop;

// From: https://rosettacode.org/wiki/Sieve_of_Eratosthenes#D
/// Extensible Sieve of Eratosthenes.
struct Prime {
    uint[] a = [2];
    private void grow() pure nothrow @safe {
        immutable p0 = a[$ - 1] + 1;
        auto b = new bool[p0];

        foreach (immutable di; a) {
            immutable uint i0 = p0 / di * di;
            uint i = (i0 < p0) ? i0 + di - p0 : i0 - p0;
            for (; i < b.length; i += di)
                b[i] = true;
        }
        foreach (immutable uint i, immutable bi; b)
            if (!b[i])
                a ~= p0 + i;
    }
    uint opCall(in uint n) pure nothrow @safe {
        while (n >= a.length)
            grow;
        return a[n];
    }
}

void main()
{
  Prime pgen;
  auto primes = uint.max.iota.map!pgen.until!q{a > 100000}.array;
  foreach (casenum ; 1 .. readln.strip.to!int + 1) {
    auto n = readln.strip.to!int;
    foreach (m ; primes) {
      if (primes.assumeSorted.contains(n + m))
        continue;
      writeln(m);
      break;
    }
  }
}

import std.stdio;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import core.stdc.stdio : scanf;
import std.conv;
import std.array;
import std.string;
import std.range;
import std.algorithm;
import std.functional;

T read(T)() { return readln.chomp.to!T; }
T[] readarray(T)() { return readln.chomp.split(" ").map!(to!T).array; }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

void solve() {
    int n = read!int;
    if (n == 2)
        writeln(7);
    else
        writeln(3);
}

void main() {
    int T = read!int;
    foreach (t; 0 .. T) solve();
}

import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		writeln (n == 2 ? 2 : 3);
	}
}


// cheese-cracker [2022-02-12]

void solve(){
    int n = scan!int;
    auto arr = scanArray;
    auto dup = arr.dup;
    dup.sort;
    bool f = 0;
    for(int i = 0; i < n; ++i){
        if(dup[i] != arr[i]){
            f = 1;
            break;
        }
    }
    if(f){
        writeln("YES");
    }else{
        writeln("NO");
    }
}

void main(){
    long tests = scan;        // Toggle!
    while(tests--) solve;
}

/*_________________________*That's All Folks!*__________________________*/
import std.stdio, std.range, std.conv, std.typecons, std.algorithm, std.container, std.math, std.numeric;
string[] tk; alias tup = Tuple!(long, long);
T scan(T=long)(){while(!tk.length)tk = readln.split; string a=tk.front; tk.popFront; return a.to!T;}
T[] scanArray(T=long)(){ auto r = readln.split.to!(T[]); return r; }
void show(A...)(A a){ debug{ foreach(t; a){stderr.write(t, "| ");} stderr.writeln; } }

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		auto n = readln.strip.to !(int);
		auto a = readln.splitter.map !(to !(int)).array;
		writeln (isSorted (a) ? "NO" : "YES");
	}
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }
double euDist(T)(T[] a, T[] b) { auto c = a.dup; c[] -= b[]; c[] *= c[]; return sqrt(cast(double)c.sum); }
double[] rotate(double[] vec, double rad) { return [cos(rad)*vec[0] - sin(rad)*vec[1], sin(rad)*vec[0] + cos(rad)*vec[1]]; }
double norm(double[] vec) { return sqrt(reduce!((a,b)=>a+b*b)(0.0, vec)); }
double dotProd(double[] a, double[] b) { auto r = a.dup; r[] *= b[]; return r.sum; }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new long[](t);
	foreach (ti; 0..t)
	{
		auto n = RD!int;
		auto a = RDA;

		foreach (i; 0..n-1)
		{
			if (a[i] > a[i+1])
				ans[ti] = true;
		}
	}

	foreach (e; ans)
		writeln(e ? "YES" : "NO");
	stdout.flush;
	debug readln;
}

import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

enum INF = 10L^^18;

void main() {
  try {
    for (; ; ) {
      const numCases = readInt;
      foreach (caseId; 0 .. numCases) {
        const N = readInt;
        auto A = new long[N];
        foreach (i; 0 .. N) {
          A[i] = readLong;
        }

        auto ls = new long[N + 1];
        auto rs = new long[N + 1];
        ls[0] = -INF;
        foreach (i; 0 .. N) {
          ls[i + 1] = max(ls[i], A[i]);
        }
        rs[N] = +INF;
        foreach_reverse (i; 0 .. N) {
          rs[i] = min(A[i], rs[i + 1]);
        }

        bool ans;
        foreach (i; 1 .. N) {
          ans = ans || (ls[i] > rs[i]);
        }
        writeln(ans ? "YES" : "NO");
      }
    }
  } catch (EOFException e) {
  }
}


import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

void main() {
    int N; scanf("%d\n", &N);
    auto u = new bool[N];
    int c;
    foreach (i; 0 .. N) {
        int x; scanf("%d", &x);
        x--;
        if (x >= N) c++;
        else if (u[x]) c++;
        u[x] = true;
    }
    writeln(c);
}

module cf_137B;

import std.stdio, std.algorithm;

void main() {
	int n;
	int[] numbers;

	readf("%d", &n);
	numbers = new int[n];
	for (auto i = 0; i < n; ++i) {
		readf(" %d", &numbers[i]);
	}

	sort(numbers);

	int skip = 0, index = 0;
	for (auto i = 1; i <= n; ++i) {
		if (index >= n) {
			++skip;
			continue;
		}

		if (numbers[index] == i) {
			while (index < n && numbers[index] == i) {
				++index;
			}
		} else {
			++skip;
		}
	}

	writeln(skip);
}

module _template;
import std.stdio;
import std.string;
import std.algorithm;
import std.container;
import std.range;
import std.math;
import std.numeric;
import std.conv;
import std.typecons;
import std.format;

struct IO {
        string[] tk;
        string readString() {
                while (tk.empty)
                        tk = readln.split;
                auto tkt = tk.front;
                tk.popFront;
                return tkt;
        }
        int readInt() {
                return readString.to!int;
        }
        double readDouble() {
                return readString.to!double;
        }
}

void main() {
        IO cin;
        int n_Cases = 1;
        // n_Cases = cin.readInt;

	for (int case_i = 1; case_i <= n_Cases; case_i++) {
                int n = cin.readInt;
                int[] arr = new int[n];
                bool[5001] present = false;
                foreach (ref i; arr) {
                        i = cin.readInt;
                        present[i] = true;
                }
                int ans = 0;
                for (int i = 1; i <= n; i++) ans += !present[i];
                writeln(ans);
        }
}

import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

void main() {
    int N; scanf("%d\n", &N);
    auto xs = readln.chomp.split(" ").map!(to!int).array;
    xs = xs.sort.uniq.array;
    writeln(N - xs.length);
}

import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.random;
import std.regex;
import std.typecons;

void main() {
    int N; scanf("%d\n", &N);
    auto u = new bool[N];
    int c;
    foreach (i; 0 .. N) {
        int x; scanf("%d", &x);
        x--;
        if (x >= N) c++;
        if (u[x]) c++;
        u[x] = true;
    }
    writeln(c);
}

module _template;
import std.stdio;
import std.string;
import std.algorithm;
import std.container;
import std.range;
import std.math;
import std.numeric;
import std.conv;
import std.typecons;
import std.format;

struct IO {
        string[] tk;
        string readString() {
                while (tk.empty)
                        tk = readln.split;
                auto tkt = tk.front;
                tk.popFront;
                return tkt;
        }
        int readInt() {
                return readString.to!int;
        }
        double readDouble() {
                return readString.to!double;
        }
}

void main() {
        IO cin;
        int n_Cases = 1;
        // n_Cases = cin.readInt;

	for (int case_i = 1; case_i <= n_Cases; case_i++) {
                int n = cin.readInt;
                int[] arr = new int[n];
                int maxx = -9999;
                bool[5001] present = false;
                foreach (ref i; arr) {
                        i = cin.readInt;
                        maxx = max(maxx, i);
                        present[i] = true;
                }
                int ans = 0;
                for (int i = 1; i <= maxx; i++) ans += !present[i];
                writeln(ans);
        }
}


void main() { runSolver(); }

void problem() {
  auto QN = scan!int;

  auto solve() {
    auto subSolve() {
      auto N = scan!int;
      auto M = scan!int;

      auto rect = GridPoint(M, N);
      auto q = DList!GridPoint();
      q.insert(GridPoint(M / 2, N / 2));
      if (M % 2 == 0) q.insert(GridPoint(M / 2 - 1, N / 2));
      if (N % 2 == 0) q.insert(GridPoint(M / 2, N / 2 - 1));
      if (M % 2 == 0 && N % 2 == 0) q.insert(GridPoint(M / 2 - 1, N / 2 - 1));

      auto visited = new bool[][](N, M);
      // foreach(c; q.array) visited[c.y][c.x] = true;

      long[] acc;
      acc ~= q.array.length;
      while(!q.empty) {
        bool[GridPoint] nex;

        while(!q.empty) {
          auto p = q.front; q.removeFront;
          if (p.of(visited)) continue;
          visited[cast(int)p.y][cast(int)p.x] = true;

          foreach(a; p.around(rect)) {
            if (a.of(visited)) continue;

            nex[a] = true;
          }
          nex.remove(p);
        }

        acc ~= acc[$ - 1] + nex.length;
        q.insert(nex.keys);
      }
      // acc.deb;

      long[] ans;
      auto center = GridPoint(M / 2, N / 2);
      long distance = center.y + center.x;
      int t;
      foreach(k; 0..N * M) {
        if (acc[t] <= k) {
          distance++;
          t++;
        }
        ans ~= distance;
      }
      return ans.toAnswerString;
    }

    foreach(i; 0..QN) {
      subSolve().writeln;
    }
  }

  outputForAtCoder(&solve);
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric, std.traits, std.functional, std.bigint, std.datetime.stopwatch, core.time, core.bitop;
T[][] combinations(T)(T[] s, in long m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(long n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");
Point invert(Point p) { return Point(p.y, p.x); }
long[] divisors(long n) { long[] ret; for (long i = 1; i * i <= n; i++) { if (n % i == 0) { ret ~= i; if (i * i != n) ret ~= n / i; } } return ret.sort.array; }
bool chmin(T)(ref T a, T b) { if (b < a) { a = b; return true; } else return false; }
bool chmax(T)(ref T a, T b) { if (b > a) { a = b; return true; } else return false; }
string charSort(alias S = "a < b")(string s) { return (cast(char[])((cast(byte[])s).sort!S.array)).to!string; }
ulong comb(ulong a, ulong b) { if (b == 0) {return 1;}else{return comb(a - 1, b - 1) * a / b;}}
T[] compress(T)(T[] arr, T origin = T.init) { T[T] indecies; arr.dup.sort.uniq.enumerate(origin).each!((i, t) => indecies[t] = i); return arr.map!(t => indecies[t]).array; }
string toAnswerString(R)(R r) { return r.map!"a.to!string".joiner(" ").array.to!string; }
struct ModInt(uint MD) if (MD < int.max) {ulong v;this(string v) {this(v.to!long);}this(int v) {this(long(v));}this(long v) {this.v = (v%MD+MD)%MD;}void opAssign(long t) {v = (t%MD+MD)%MD;}static auto normS(ulong x) {return (x<MD)?x:x-MD;}static auto make(ulong x) {ModInt m; m.v = x; return m;}auto opBinary(string op:"+")(ModInt r) const {return make(normS(v+r.v));}auto opBinary(string op:"-")(ModInt r) const {return make(normS(v+MD-r.v));}auto opBinary(string op:"*")(ModInt r) const {return make((ulong(v)*r.v%MD).to!ulong);}auto opBinary(string op:"^^", T)(T r) const {long x=v;long y=1;while(r){if(r%2==1)y=(y*x)%MD;x=x^^2%MD;r/=2;} return make(y);}auto opBinary(string op:"/")(ModInt r) const {return this*memoize!inv(r);}static ModInt inv(ModInt x) {return x^^(MD-2);}string toString() const {return v.to!string;}auto opOpAssign(string op)(ModInt r) {return mixin ("this=this"~op~"r");}}
alias MInt1 = ModInt!(10^^9 + 7);
alias MInt9 = ModInt!(998_244_353);
void outputForAtCoder(T)(T delegate() fn) {
  static if (is(T == float) || is(T == double) || is(T == real)) "%.16f".writefln(fn());
  else static if (is(T == void)) fn();
  else static if (is(T == string)) fn().writeln;
  else static if (isInputRange!T) {
    static if (!is(string == ElementType!T) && isInputRange!(ElementType!T)) foreach(r; fn()) r.toAnswerString.writeln;
    else foreach(r; fn()) r.writeln;
  }
  else fn().writeln;
}
void runSolver() {
  enum BORDER = "==================================";
  debug { BORDER.writeln; while(!stdin.eof) { "<<< Process time: %s >>>".writefln(benchmark!problem(1)); BORDER.writeln; } }
  else problem();
}
enum YESNO = [true: "Yes", false: "No"];

// -----------------------------------------------

struct GridPoint {
  static enum ZERO = GridPoint(0, 0);
  long x, y;

  static GridPoint reversed(long y, long x) {
    return GridPoint(x, y);
  }

  this(long x, long y) {
    this.x = x;
    this.y = y;
  }

  inout GridPoint left() { return GridPoint(x - 1, y); }
  inout GridPoint right() { return GridPoint(x + 1, y); }
  inout GridPoint up() { return GridPoint(x, y - 1); }
  inout GridPoint down() { return GridPoint(x, y + 1); }
  inout GridPoint leftUp() { return GridPoint(x - 1, y - 1); }
  inout GridPoint leftDown() { return GridPoint(x - 1, y + 1); }
  inout GridPoint rightUp() { return GridPoint(x + 1, y - 1); }
  inout GridPoint rightDown() { return GridPoint(x + 1, y + 1); }
  inout GridPoint[] around() { return [left(), up(), right(), down()]; }
  inout GridPoint[] around(GridPoint max) { GridPoint[] ret; if (x > 0) ret ~= left; if(x < max.x-1) ret ~= right; if(y > 0) ret ~= up; if(y < max.y-1) ret ~= down; return ret; }
  inout T of(T)(inout ref T[][] grid) { return grid[cast(int)y][cast(int)x]; }
}

import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	auto tests = readln.strip.to !(int);
	foreach (test; 0..tests)
	{
		int rows, cols;
		readf !(" %s %s") (rows, cols);
		int [] s;
		foreach (row; 0..rows)
		{
			foreach (col; 0..cols)
			{
				s ~= max (row, rows - row - 1) +
				    max (col, cols - col - 1);
			}
		}
		sort (s);
		writefln !("%(%s %)") (s);
	}
}


import std.stdio;

void main() {
    long t, n, m;
    readf!"%d\n"(t);

    while (t--) {
        readf!"%d %d\n"(n, m);

        long cycle_len = 1;
        long cycle_sum = 0;
        while ((cycle_len * m) % 10) {
            cycle_sum += (cycle_len++ * m) % 10;
        }
        cycle_len *= m;

        long total = (n / cycle_len) * cycle_sum;

        for (int i = 1; i <= (n % cycle_len) / m; i++)
            total += (i * m) % 10;

        writeln(total);
    }
}

import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto q = RD!int;
	auto ans = new long[](q);
	foreach (i; 0..q)
	{
		auto n = RD;
		auto m = RD;
		long[] a = [0];
		while ((a.back + m) % 10 != 0)
		{
			a ~= (a.back + m) % 10;
		}
		a.popFront;
		a ~= 0;
		auto x = a.sum;
		auto y = n / m;
		long z1, z2;
		if (y != 0)
		{
			z1 = y / a.length;
			z2 = y % a.length;
		}
		ans[i] = z1 * x + a[0..cast(int)z2].sum;
	}

	foreach (e; ans)
		writeln(e);
	stdout.flush();
	debug readln();
}