You, a wizard whose creation was destroyed by a dragon, are determined to hunt it down with a magical AOE tracker. But it seems to be toyed with...

This is an interactive problem.

There is a hidden binary array $a$ of length $n$ ($\mathbf{n}$ is a power of 2) and a hidden integer $k\ (2 \le k \le n - 1)$. The array $a$ contains exactly one 1 (and all other elements are 0). For two integers $l$ and $r$ ($1 \le l \le r \le n$), define the range sum $s(l, r) = a_l + a_{l+1} + \cdots + a_r$.

You have a magical device that takes ranges and returns range sums, but it returns the opposite result when the range has length at least $k$. Formally, in one query, you can give it a pair of integers $[l, r]$ where $1 \le l \le r \le n$, and it will return either $0$ or $1$ according to the following rules:

* If $r - l + 1 < k$, it will return $s(l, r)$.
* If $r - l + 1 \ge k$, it will return $1 - s(l, r)$.

Find $k$ using at most $33$ queries.

The device is not adaptive. It means that the hidden $a$ and $k$ are fixed before the interaction and will not change during the interaction.

Interaction

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 500$). The description of the test cases follows.

The first line of each test case contains one positive integer $n$ ($4 \le n \le 2^{30}$) — the length of the hidden array. It is guaranteed that $\mathbf{n}$ is a power of 2; that is, $n = 2^m$ for some non-negative integer $m$.

You can make queries in the following way — print one line of the form "$\mathtt{?}\,l\,r$" where $1 \le l \le r \le n$. After that, read a single integer: $0$ or $1$, as described in the statement.

If you want to print the answer $k$, output "$\mathtt{!}\,k$". Then, the interaction continues with the next test case.

Printing the answer does not count towards the number of queries made.

After printing each query do not forget to output the end of line and flush$^{\text{∗}}$ the output. Otherwise, you will get Idleness limit exceeded verdict.

If, at any interaction step, you read $-1$ instead of valid data, your solution must exit immediately. This means that your solution will receive Wrong answer because of an invalid query or any other mistake. Failing to exit can result in an arbitrary verdict because your solution will continue to read from a closed stream.

Example

Input

```
2
8

0

0

1

0

4

1

0
```

Output

```
? 3 5

? 1 8

? 4 8

? 3 8

! 6

? 3 3

? 3 4

! 2
```

Note

In the first test case, $k = 6$ and the 1 in the hidden array is at index 6, so $a = [0, 0, 0, 0, 0, 1, 0, 0]$.

* For the query 3 5, since $5-3+1 = 3 < k$, the device answers correctly. Since 6 is not contained in the range $[3, 5]$, the device answers $0$.
* For the query 1 8, since $8 - 1 + 1 = 8 \ge k$, the device answers $0$ incorrectly.
* For the query 4 8, since $8 - 4 + 1 = 5 < k$, the device answers $1$ correctly.
* For the query 3 8, since $8 - 3 + 1 = 6 \ge k$, the device answers $0$ incorrectly.

The example solution then outputs $6$ as the answer, which is correct.

In the second test case, $k = 2$ and the 1 in the hidden array is at index 3, so $a = [0, 0, 1, 0]$.

Note that the example solution may not have enough information to determine $k$ above; this is only an example.

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

static long long queries = 0;
static long long query_limit = 0;
static long long hard_cap = 0;

static void log_metrics() {
    try {
        tout << "queries=" << queries << '\n';
        tout << "query_limit=" << query_limit << '\n';
        tout.flush();
    } catch (...) {
    }
}

static void finish(TResult verdict, const string& msg) {
    log_metrics();
    quitf(verdict, "%s", msg.c_str());
}

static bool readToken(string& s) {
    return (cin >> s) ? true : false;
}

static bool parseLongLongStrict(const string& s, long long& out) {
    if (s.empty()) return false;
    size_t i = 0;
    bool neg = false;
    if (s[i] == '+' || s[i] == '-') {
        neg = (s[i] == '-');
        i++;
    }
    if (i >= s.size()) return false;
    long long val = 0;
    for (; i < s.size(); i++) {
        char c = s[i];
        if (c < '0' || c > '9') return false;
        int d = c - '0';
        if (!neg) {
            if (val > (LLONG_MAX - d) / 10) return false;
            val = val * 10 + d;
        } else {
            if (val < (LLONG_MIN + d) / 10) return false;
            val = val * 10 - d;
        }
    }
    out = val;
    return true;
}

static bool isPowerOfTwo(long long x) {
    return x >= 1 && (x & (x - 1)) == 0;
}

int main(int argc, char** argv) {
    registerInteraction(argc, argv);
    atexit(log_metrics);

    int t = inf.readInt();
    if (t < 1 || t > 500) finish(_pe, "Invalid t in hidden input");

    vector<long long> n(t), k(t), pos(t);
    for (int i = 0; i < t; i++) {
        n[i] = inf.readLong();
        k[i] = inf.readLong();
        pos[i] = inf.readLong();

        if (n[i] < 4LL || n[i] > (1LL << 30) || !isPowerOfTwo(n[i])) finish(_pe, "Invalid n in hidden input");
        if (k[i] < 2LL || k[i] > n[i] - 1) finish(_pe, "Invalid k in hidden input");
        if (pos[i] < 1LL || pos[i] > n[i]) finish(_pe, "Invalid pos in hidden input");
    }

    query_limit = 33LL * t;
    hard_cap = max(200000LL, 10LL * query_limit);

    log_metrics();

    cout << t << '\n';
    cout.flush();

    for (int tc = 0; tc < t; tc++) {
        cout << n[tc] << '\n';
        cout.flush();

        while (true) {
            string cmd;
            if (!readToken(cmd)) finish(_pe, "Unexpected EOF from contestant");

            if (cmd == "?") {
                string sl, sr;
                if (!readToken(sl) || !readToken(sr)) finish(_pe, "Incomplete query");

                long long l, r;
                if (!parseLongLongStrict(sl, l) || !parseLongLongStrict(sr, r)) {
                    cout << -1 << '\n';
                    cout.flush();
                    finish(_pe, "Non-integer query bounds");
                }

                if (!(1LL <= l && l <= r && r <= n[tc])) {
                    cout << -1 << '\n';
                    cout.flush();
                    finish(_pe, "Query out of bounds");
                }

                queries++;
                if (queries > hard_cap) {
                    cout << -1 << '\n';
                    cout.flush();
                    finish(_pe, "Hard cap exceeded");
                }

                long long len = r - l + 1;
                int sum = (l <= pos[tc] && pos[tc] <= r) ? 1 : 0;
                int ans = (len < k[tc]) ? sum : (1 - sum);

                cout << ans << '\n';
                cout.flush();
            } else if (cmd == "!") {
                string sk;
                if (!readToken(sk)) finish(_pe, "Incomplete answer");
                long long guess;
                if (!parseLongLongStrict(sk, guess)) finish(_pe, "Non-integer answer");

                if (guess != k[tc]) finish(_wa, "Wrong k");
                break;
            } else {
                finish(_pe, "Unknown command");
            }
        }
    }

    finish(_ok, "OK");
    return 0;
}

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

static long long queries = 0;
static long long query_limit = 0;

static void log_metrics() {
    try {
        tout << "queries=" << queries << "\n";
        tout << "query_limit=" << query_limit << "\n";
        tout.flush();
    } catch (...) {

    }
}

static void finish(TResult verdict, const string& msg) {
    log_metrics();
    quitf(verdict, "%s", msg.c_str());
}

static uint64_t fnv1a64(const string& s) {
    uint64_t h = 1469598103934665603ULL;
    for (unsigned char c : s) {
        h ^= (uint64_t)c;
        h *= 1099511628211ULL;
    }
    return h;
}

static uint64_t splitmix64(uint64_t x) {
    x += 0x9E3779B97F4A7C15ULL;
    x = (x ^ (x >> 30)) * 0xBF58476D1CE4E5B9ULL;
    x = (x ^ (x >> 27)) * 0x94D049BB133111EBULL;
    return x ^ (x >> 31);
}

static bool parseLL(const string& s, long long& out) {
    if (s.empty()) return false;
    int i = 0;
    bool neg = false;
    if (s[0] == '-') {
        neg = true;
        i = 1;
        if ((int)s.size() == 1) return false;
    }
    long long val = 0;
    for (; i < (int)s.size(); i++) {
        char c = s[i];
        if (c < '0' || c > '9') return false;
        int d = c - '0';
        if (!neg) {
            if (val > (LLONG_MAX - d) / 10) return false;
            val = val * 10 + d;
        } else {
            if (val < (LLONG_MIN + d) / 10) return false;
            val = val * 10 - d;
        }
    }
    out = val;
    return true;
}

static bool isPowerOfTwo(long long x) {
    return x >= 1 && (x & (x - 1)) == 0;
}

struct Interval {
    long long l, r;
};

static long long measureIntervals(const vector<Interval>& v) {
    long long sum = 0;
    for (const auto& it : v) {
        if (it.l <= it.r) sum += (it.r - it.l + 1);
    }
    return sum;
}

static vector<Interval> intersectWith(const vector<Interval>& v, long long l, long long r) {
    vector<Interval> res;
    if (l > r) return res;
    for (const auto& it : v) {
        long long nl = max(it.l, l);
        long long nr = min(it.r, r);
        if (nl <= nr) res.push_back({nl, nr});
    }
    return res;
}

static vector<Interval> subtractRange(const vector<Interval>& v, long long l, long long r) {
    vector<Interval> res;
    if (l > r) return v;
    for (const auto& it : v) {
        if (it.r < l || it.l > r) {
            res.push_back(it);
            continue;
        }
        if (it.l < l) res.push_back({it.l, l - 1});
        if (it.r > r) res.push_back({r + 1, it.r});
    }
    return res;
}

struct Cell {
    long long kl, kr;
    vector<Interval> pos;
};

static bool samePos(const vector<Interval>& a, const vector<Interval>& b) {
    if (a.size() != b.size()) return false;
    for (size_t i = 0; i < a.size(); i++) {
        if (a[i].l != b[i].l || a[i].r != b[i].r) return false;
    }
    return true;
}

static void mergeCells(vector<Cell>& cells) {
    if (cells.empty()) return;
    sort(cells.begin(), cells.end(), [](const Cell& x, const Cell& y) {
        if (x.kl != y.kl) return x.kl < y.kl;
        return x.kr < y.kr;
    });
    vector<Cell> merged;
    merged.reserve(cells.size());
    for (auto& c : cells) {
        if (c.kl > c.kr) continue;
        if (c.pos.empty()) continue;
        if (merged.empty()) {
            merged.push_back(std::move(c));
            continue;
        }
        Cell& back = merged.back();
        if (back.kr + 1 == c.kl && samePos(back.pos, c.pos)) {
            back.kr = c.kr;
        } else {
            merged.push_back(std::move(c));
        }
    }
    cells.swap(merged);
}

static vector<Cell> applyAnswer(const vector<Cell>& cells, long long l, long long r, long long L, int ans) {
    vector<Cell> out;
    out.reserve(cells.size() * 2);

    for (const auto& cell : cells) {

        long long aL = cell.kl;
        long long aR = min(cell.kr, L);
        if (aL <= aR) {
            int kLeq = 1;
            int posIn = ans ^ kLeq;
            vector<Interval> np = cell.pos;
            if (posIn) np = intersectWith(np, l, r);
            else np = subtractRange(np, l, r);
            if (!np.empty()) out.push_back({aL, aR, std::move(np)});
        }

        long long bL = max(cell.kl, L + 1);
        long long bR = cell.kr;
        if (bL <= bR) {
            int kLeq = 0;
            int posIn = ans ^ kLeq;
            vector<Interval> np = cell.pos;
            if (posIn) np = intersectWith(np, l, r);
            else np = subtractRange(np, l, r);
            if (!np.empty()) out.push_back({bL, bR, std::move(np)});
        }
    }

    mergeCells(out);
    return out;
}

static long long measureK(const vector<Cell>& cells) {
    long long sum = 0;
    for (const auto& c : cells) {
        if (c.kl <= c.kr) sum += (c.kr - c.kl + 1);
    }
    return sum;
}

static __int128 measurePairs(const vector<Cell>& cells) {
    __int128 sum = 0;
    for (const auto& c : cells) {
        if (c.kl > c.kr) continue;
        long long klen = c.kr - c.kl + 1;
        long long p = measureIntervals(c.pos);
        sum += (__int128)klen * (__int128)p;
    }
    return sum;
}

static bool kFeasibleAndAllSame(const vector<Cell>& cells, long long kGuess, bool& guessFeasible) {
    guessFeasible = false;
    bool allSame = true;
    bool any = false;
    for (const auto& c : cells) {
        if (c.kl > c.kr) continue;
        if (c.pos.empty()) continue;
        any = true;
        if (c.kl <= kGuess && kGuess <= c.kr) guessFeasible = true;
        if (!(c.kl == c.kr && c.kl == kGuess)) allSame = false;
    }
    if (!any) {

        finish(_pe, "internal: empty feasible set");
    }
    return allSame;
}

int main(int argc, char** argv) {
    registerInteraction(argc, argv);
    atexit(log_metrics);

    int t = 0;
    try {
        t = inf.readInt();
    } catch (...) {
        finish(_pe, "failed to read t from inf");
    }
    if (t < 1 || t > 500) finish(_pe, "t out of bounds");

    vector<string> toks;
    while (!inf.seekEof()) toks.push_back(inf.readToken());

    vector<long long> ns(t, -1), ks(t, -1), ps(t, -1);
    bool nonAdaptive = false;

    if (toks.size() == (size_t)t) {
        for (int i = 0; i < t; i++) {
            long long x;
            if (!parseLL(toks[i], x)) finish(_pe, "bad n token");
            ns[i] = x;
        }
    } else if (toks.size() == (size_t)3 * t) {
        nonAdaptive = true;
        for (int i = 0; i < t; i++) {
            long long n, k, p;
            if (!parseLL(toks[3 * i + 0], n)) finish(_pe, "bad n token");
            if (!parseLL(toks[3 * i + 1], k)) finish(_pe, "bad k token");
            if (!parseLL(toks[3 * i + 2], p)) finish(_pe, "bad pos token");
            ns[i] = n;
            ks[i] = k;
            ps[i] = p;
        }
    } else {
        finish(_pe, "inf format unsupported (expected t*n or t*(n,k,pos))");
    }

    if (!nonAdaptive) {
        uint64_t base = fnv1a64(inf.name);
        for (int i = 0; i < t; i++) {
            long long n = ns[i];
            if (n < 4) finish(_pe, "n invalid while synthesizing k/pos");
            uint64_t seed = base;
            seed ^= (uint64_t)n * 0x9E3779B97F4A7C15ULL;
            seed ^= (uint64_t)(i + 1) * 0xBF58476D1CE4E5B9ULL;
            uint64_t z = splitmix64(seed);
            long long k = 2 + (long long)(z % (uint64_t)(n - 2));
            long long p = 1 + (long long)(((z >> 32) ^ z) % (uint64_t)n);
            ks[i] = k;
            ps[i] = p;
        }
        nonAdaptive = true;
    }

    for (int i = 0; i < t; i++) {
        long long n = ns[i];
        if (n < 4 || n > (1LL << 30) || !isPowerOfTwo(n)) finish(_pe, "n invalid in inf");
        if (nonAdaptive) {
            long long k = ks[i], p = ps[i];
            if (k < 2 || k > n - 1) finish(_pe, "k invalid in inf");
            if (p < 1 || p > n) finish(_pe, "pos invalid in inf");
        }
    }

    query_limit = 33LL * t;
    const long long hard_cap = max(200000LL, 10LL * query_limit);

    cout << t << "\n";
    cout.flush();

    log_metrics();

    for (int tc = 0; tc < t; tc++) {
        long long n = ns[tc];
        cout << n << "\n";
        cout.flush();

        bool fixed = nonAdaptive;
        long long fixedK = fixed ? ks[tc] : -1;
        long long fixedPos = fixed ? ps[tc] : -1;

        vector<Cell> cells;
        if (!fixed) {
            cells.push_back({2, n - 1, vector<Interval>{{1, n}}});
        }

        while (true) {
            string cmd;
            if (!(cin >> cmd)) finish(_pe, "unexpected EOF from contestant");

            if (cmd == "?") {
                string sl, sr;
                if (!(cin >> sl >> sr)) finish(_pe, "bad query format");
                long long l, r;
                if (!parseLL(sl, l) || !parseLL(sr, r)) finish(_pe, "non-integer in query");
                if (!(1 <= l && l <= r && r <= n)) finish(_pe, "query range out of bounds");

                queries++;
                if (queries > hard_cap) finish(_pe, "too many queries (hard cap exceeded)");

                long long L = r - l + 1;
                int reply = 0;

                if (fixed) {
                    int posIn = (l <= fixedPos && fixedPos <= r) ? 1 : 0;
                    int lenGeK = (L >= fixedK) ? 1 : 0;
                    reply = posIn ^ lenGeK;
                } else {
                    vector<Cell> c0 = applyAnswer(cells, l, r, L, 0);
                    vector<Cell> c1 = applyAnswer(cells, l, r, L, 1);

                    long long m0 = measureK(c0);
                    long long m1 = measureK(c1);

                    if (m0 == 0 && m1 == 0) finish(_pe, "internal: no feasible answer");

                    if (m1 > m0) {
                        reply = 1;
                        cells.swap(c1);
                    } else if (m0 > m1) {
                        reply = 0;
                        cells.swap(c0);
                    } else {
                        __int128 p0 = measurePairs(c0);
                        __int128 p1 = measurePairs(c1);
                        if (p1 > p0) {
                            reply = 1;
                            cells.swap(c1);
                        } else {
                            reply = 0;
                            cells.swap(c0);
                        }
                    }
                }

                cout << reply << "\n";
                cout.flush();
                continue;
            }

            if (cmd == "!") {
                string sk;
                if (!(cin >> sk)) finish(_pe, "bad answer format");
                long long kGuess;
                if (!parseLL(sk, kGuess)) finish(_pe, "non-integer k");
                if (!(2 <= kGuess && kGuess <= n - 1)) finish(_pe, "k out of bounds");

                if (fixed) {
                    if (kGuess != fixedK) finish(_wa, "wrong k");
                } else {
                    bool guessFeasible = false;
                    bool allSame = kFeasibleAndAllSame(cells, kGuess, guessFeasible);
                    if (!guessFeasible) finish(_wa, "k not feasible");
                    if (!allSame) finish(_wa, "k not uniquely determined");
                }
                break;
            }

            finish(_pe, "unknown command");
        }
    }

    finish(_ok, "ok");
    return 0;
}

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

static long long clampll(long long x, long long lo, long long hi) {
    if (x < lo) return lo;
    if (x > hi) return hi;
    return x;
}

static bool isPowerOfTwo(long long x) {
    return x >= 1 && (x & (x - 1)) == 0;
}

static long long pickN(long long seed) {
    if (seed == 1 || seed == 2) return 4;
    if (seed == 3) return (1LL << 30);

    int coin = rnd.next(0, 99);
    int m;
    if (coin < 70) m = rnd.next(25, 30);
    else if (coin < 90) m = rnd.next(16, 30);
    else m = rnd.next(2, 30);
    return 1LL << m;
}

static long long pickK(long long n, long long seed) {
    if (seed == 1) return 2;
    if (seed == 2) return 3;
    if (seed == 3) return n - 1;

    int pat = rnd.next(0, 99);
    long long k = 2;

    if (pat < 22) {
        long long hi = min(n - 1, 20LL);
        k = rnd.next(2LL, hi);
    } else if (pat < 44) {
        long long lo = max(2LL, (n - 1) - 19LL);
        k = rnd.next(lo, n - 1);
    } else if (pat < 70) {
        long long base = n / 2;
        long long lim = max(1LL, n / 16);
        long long delta = rnd.next(-lim, lim);
        k = base + delta;
    } else if (pat < 88) {
        int m = 0;
        while ((1LL << (m + 1)) <= n) m++;
        int x = rnd.next(1, max(1, m - 1));
        long long p2 = 1LL << x;
        int var = rnd.next(0, 2);
        if (var == 0) k = p2;
        else if (var == 1) k = p2 + 1;
        else k = p2 - 1;
    } else {
        k = rnd.next(2LL, n - 1);
    }

    return clampll(k, 2LL, n - 1);
}

static long long pickPos(long long n, long long k, long long seed) {
    if (seed == 1) return n;
    if (seed == 2) return 2;
    if (seed == 3) return n / 2;

    int pat = rnd.next(0, 99);
    long long pos;

    if (pat < 25) {
        pos = (rnd.next(0, 1) ? 1LL : n);
    } else if (pat < 55) {
        vector<long long> cand;
        cand.push_back(n / 2);
        cand.push_back(min(n, n / 2 + 1));
        cand.push_back(max(1LL, n / 4));
        cand.push_back(min(n, (3LL * n) / 4));
        cand.push_back(clampll(k, 1LL, n));
        cand.push_back(clampll(n - k + 1, 1LL, n));
        pos = cand[rnd.next(0, (int)cand.size() - 1)];
    } else {
        pos = rnd.next(1LL, n);
    }

    return clampll(pos, 1LL, n);
}

int main(int argc, char* argv[]) {
    registerGen(argc, argv, 1);

    string mode = opt<string>("mode", "non");
    long long seed = 1;
    if (argc >= 2) seed = atoll(argv[1]);

    long long nOpt = opt<long long>("n", -1LL);
    long long kOpt = opt<long long>("k", -1LL);
    long long posOpt = opt<long long>("pos", -1LL);

    long long n = (nOpt > 0 ? nOpt : pickN(seed));
    ensuref(4LL <= n && n <= (1LL << 30), "n out of bounds");
    ensuref(isPowerOfTwo(n), "n must be a power of two");

    if (mode == "non") {
        long long k = (kOpt != -1 ? kOpt : pickK(n, seed));
        ensuref(2LL <= k && k <= n - 1, "k out of bounds");

        long long pos = (posOpt != -1 ? posOpt : pickPos(n, k, seed));
        ensuref(1LL <= pos && pos <= n, "pos out of bounds");

        cout << 1 << "\n";
        cout << n << " " << k << " " << pos << "\n";
    } else if (mode == "adp") {

        long long k = (kOpt != -1 ? kOpt : pickK(n, seed));
        ensuref(2LL <= k && k <= n - 1, "k out of bounds");

        long long pos = (posOpt != -1 ? posOpt : pickPos(n, k, seed));
        ensuref(1LL <= pos && pos <= n, "pos out of bounds");

        cout << 1 << "\n";
        cout << n << " " << k << " " << pos << "\n";
    } else {
        ensuref(false, "unknown --mode (use non/adp)");
    }

    return 0;
}


This is an interactive problem.

There are $n$ distinct hidden points with real coordinates on a two-dimensional Euclidean plane. In one query, you can ask some line $ax + by + c = 0$ and get the projections of all $n$ points to this line in some order. The given projections are not exact, please read the interaction section for more clarity.

Using the minimum number of queries, guess all $n$ points and output them in some order. Here minimality means the minimum number of queries required to solve any possible test case with $n$ points.

The hidden points are fixed in advance and do not change throughout the interaction. In other words, the interactor is not adaptive.

A projection of point $A$ to line $ax + by + c = 0$ is the point on the line closest to $A$.

Input

The first line contains a single integer $t$ ($1 \leq t \leq 50$) — the number of test cases.

The description of the test cases follows.

The first line of each test case contains a single integer $n$ ($2 \leq n \leq 25$) — the number of hidden points.

For each test case, it is guaranteed that for any pair of hidden points, their $x$ coordinates differ by at least $1$. Analogously, $y$ coordinates of any pair also differ by at least $1$.

Coordinates $x$ and $y$ of all hidden points do not exceed $100$ by absolute value.

Interaction

To query a line $ax + by + c = 0$ you should print "? a b c" where all a, b and c are real numbers up to $100$ by absolute value. For less precision issues numbers $a$ and $b$ must satisfy the condition $|a| + |b| \geq 0.1$, where $|a|$ is the absolute value of $a$.

As an answer to the query you will get $n$ points in the form "x\_1 y\_1 ... x\_n y\_n", where points $(x_i, y_i)$ are projections to the line $ax + by + c = 0$. It is guaranteed that each printed point is no more than $10^{-4}$ away from the real projection point. Every coordinate is printed with at most 9 decimal places.

See the interaction example for more clarity.

If you ask too many queries, you will get Wrong answer.

To output an answer you should print "! x\_1 y\_1 ... x\_n y\_n", where $(x_i, y_i)$ are coordinates of the hidden points. You could output the hidden points in any order. The answer would be considered correct if each of the printed points is no more than $10^{-3}$ away from the corresponding hidden point. Printing the answer doesn't count as a query.

After printing a query or the answer, do not forget to output end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

* fflush(stdout) or cout.flush() in C++;
* System.out.flush() in Java;
* flush(output) in Pascal;
* stdout.flush() in Python;
* see the documentation for other languages

Example

Input

```
1
2

1 1 2.5 1

1.500000001 1.500000000 2 2
```

Output

```
? 0 1 -1

? 0.2 -0.2 0

! 1 3 2.5 0.500000001
```

Note

In the sample the hidden points are $(1, 3)$ and $(2.5, 0.5)$

A picture, which describes the first query:

![](https://espresso.codeforces.com/86aa468eed88633fca95efaeae1feba89103565d.png)

A picture, which describes the second query:

![](https://espresso.codeforces.com/810b3a8ee0cdbceb2e328abedc03c48ad4284593.png)

#include "testlib.h"
#include <bits/stdc++.h>

using namespace std;

static long long queries = 0;
static long long query_limit = 0;
static const long long HARD_CAP = 2000;

struct Point {
    double x, y;
};

void log_metrics() {

    try {
        tout << "queries=" << queries << endl;
        tout << "query_limit=" << query_limit << endl;
    } catch (...) {

    }
}

void finish(TResult verdict, const string& msg) {
    log_metrics();
    quitf(verdict, "%s", msg.c_str());
}

Point project(Point p, double a, double b, double c) {
    double val = a * p.x + b * p.y + c;
    double len_sq = a * a + b * b;

    if (len_sq < 1e-18) return {0.0, 0.0};
    return {p.x - a * val / len_sq, p.y - b * val / len_sq};
}

int main(int argc, char* argv[]) {

    registerInteraction(argc, argv);

    atexit(log_metrics);

    int t = inf.readInt();

    cout << t << endl;
    cout.flush();

    const long long QUERY_LIMIT_PER_CASE = 3;
    query_limit = 1LL * t * QUERY_LIMIT_PER_CASE;
    log_metrics();

    signal(SIGPIPE, SIG_IGN);

    for (int cas = 0; cas < t; cas++) {
        int n = inf.readInt(2, 25, "n");
        vector<Point> hidden(n);
        for (int i = 0; i < n; i++) {
            hidden[i].x = inf.readDouble();
            hidden[i].y = inf.readDouble();
        }

        cout << n << endl;
        cout.flush();

        int used_this_case = 0;
        while (true) {
            if (queries > HARD_CAP) {
                finish(_pe, "Hard cap exceeded");
            }

            string token;
            if (!(cin >> token)) {
                cout << -1 << endl;
                cout.flush();
                finish(_wa, "Unexpected EOF (expected query or answer)");
            }

            if (token == "!") {
                vector<Point> ans(n);
                for (int i = 0; i < n; i++) {
                    if (!(cin >> ans[i].x >> ans[i].y)) {
                        cout << -1 << endl;
                        cout.flush();
                        finish(_wa, "Malformed answer coordinates");
                    }
                }

                const double tol_sq = 1.05e-6;
                vector<char> used(n, 0);
                for (const auto& h : hidden) {
                    bool found = false;
                    for (int i = 0; i < n; i++) {
                        if (used[i]) continue;
                        double dx = h.x - ans[i].x;
                        double dy = h.y - ans[i].y;
                        if (dx * dx + dy * dy <= tol_sq) {
                            used[i] = 1;
                            found = true;
                            break;
                        }
                    }
                    if (!found) {
                        cout << -1 << endl;
                        cout.flush();
                        finish(_wa, "Guessed points do not match hidden points within tolerance");
                    }
                }

                break;
            }

            if (token != "?") {
                cout << -1 << endl;
                cout.flush();
                finish(_wa, "Invalid token (expected '?' or '!')");
            }

            if (used_this_case >= (int)QUERY_LIMIT_PER_CASE) {
                cout << -1 << endl;
                cout.flush();
                finish(_wa, "Query limit exceeded");
            }

            double a, b, c;
            if (!(cin >> a >> b >> c)) {
                cout << -1 << endl;
                cout.flush();
                finish(_wa, "Malformed query parameters");
            }

            if (fabs(a) > 100.0 + 1e-12 || fabs(b) > 100.0 + 1e-12 || fabs(c) > 100.0 + 1e-12) {
                cout << -1 << endl;
                cout.flush();
                finish(_wa, "Line parameters out of bounds (abs must be <= 100)");
            }
            if (fabs(a) + fabs(b) < 0.1 - 1e-12) {
                cout << -1 << endl;
                cout.flush();
                finish(_wa, "Invalid line parameters: |a| + |b| must be >= 0.1");
            }

            used_this_case++;
            queries++;
            if (queries % 10 == 0) log_metrics();

            vector<pair<double, double>> projs;
            projs.reserve(n);
            for (const auto& h : hidden) {
                Point p = project(h, a, b, c);

                p.x += rnd.next(-1e-4, 1e-4);
                p.y += rnd.next(-1e-4, 1e-4);
                projs.push_back({p.x, p.y});
            }

            shuffle(projs.begin(), projs.end());

            cout << fixed << setprecision(9);
            for (int i = 0; i < n; i++) {
                cout << projs[i].first << " " << projs[i].second << (i + 1 == n ? "" : " ");
            }
            cout << endl;
            cout.flush();
        }
    }

    finish(_ok, "Correct");
}

#include "testlib.h"
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char* argv[]) {

    registerGen(argc, argv, 1);

    string mode = opt<string>("mode", "non");

    int n_arg = opt<int>("n", -1);

    long long seed_val = 0;
    if (argc > 1) {
        try {
            seed_val = stoll(argv[1]);
        } catch (...) {
            seed_val = 0;
        }
    }

    int n;
    if (n_arg != -1) {
        n = n_arg;
    } else {

        if (seed_val == 1) n = 2;
        else if (seed_val == 2) n = 25;
        else n = rnd.next(2, 25);
    }

    cout << 1 << endl;
    cout << n << endl;

    auto generate_axis = [&](bool tight_packing) {
        vector<double> coords(n);
        double range_width = 200.0;
        double required_space = (n - 1) * 1.0;
        double slack = range_width - required_space;

        vector<double> gaps;
        double sum_gaps = 0;
        for (int i = 0; i <= n; i++) {
            double g;
            if (tight_packing) {

                if (rnd.next(5) == 0) g = rnd.next(1.0);
                else g = 0.0;
            } else {

                g = rnd.next(1.0);
            }
            gaps.push_back(g);
            sum_gaps += g;
        }

        if (sum_gaps < 1e-9) sum_gaps = 1.0;

        double current = -100.0 + gaps[0] * (slack / sum_gaps);
        for (int i = 0; i < n; i++) {
            coords[i] = current;
            if (i < n - 1) {

                current += 1.0 + gaps[i+1] * (slack / sum_gaps);
            }
        }
        return coords;
    };

    bool stress = (seed_val == 2);

    vector<double> x_coords = generate_axis(stress);
    vector<double> y_coords = generate_axis(stress);

    shuffle(y_coords.begin(), y_coords.end());

    if (mode == "adp") {

    }

    vector<pair<double, double>> points(n);
    for (int i = 0; i < n; i++) {
        points[i] = {x_coords[i], y_coords[i]};
    }

    shuffle(points.begin(), points.end());

    cout << fixed << setprecision(20);
    for (const auto& p : points) {
        cout << p.first << " " << p.second << endl;
    }

    return 0;
}


This is an interactive problem.

Chouti was tired of studying, so he opened the computer and started playing a puzzle game.

Long long ago, the boy found a sequence $s_1, s_2, \ldots, s_n$ of length $n$, kept by a tricky interactor. It consisted of $0$s and $1$s only and the number of $1$s is $t$. The boy knows nothing about this sequence except $n$ and $t$, but he can try to find it out with some queries with the interactor.

We define an operation called flipping. Flipping $[l,r]$ ($1 \leq l \leq r \leq n$) means for each $x \in [l,r]$, changing $s_x$ to $1-s_x$.

In each query, the boy can give the interactor two integers $l,r$ satisfying $1 \leq l \leq r \leq n$ and the interactor will either flip $[1,r]$ or $[l,n]$ (both outcomes have the same probability and all decisions made by interactor are independent from each other, see Notes section for more details). The interactor will tell the current number of $1$s after each operation. Note, that the sequence won't be restored after each operation.

Help the boy to find the original sequence in no more than $10000$ interactions.

"Weird legend, dumb game." he thought. However, after several tries, he is still stuck with it. Can you help him beat this game?

Interaction

The interaction starts with a line containing two integers $n$ and $t$ ($1 \leq n \leq 300$, $0 \leq t \leq n$) — the length of the sequence and the number of $1$s in it.

After that, you can make queries.

To make a query, print a line "? l r" ($1 \leq l \leq r \leq n$), then flush the output.

After each query, read a single integer $t$ ($-1 \leq t \leq n$).

* If $t=-1$, it means that you're out of queries, you should terminate your program immediately, then you will get Wrong Answer, otherwise the judging result would be undefined because you will interact with a closed stream.
* If $t \geq 0$, it represents the current number of $1$s in the sequence.

When you found the original sequence, print a line "! s", flush the output and terminate. Print $s_1, s_2, \ldots, s_n$ as a binary string and do not print spaces in between.

Your solution will get Idleness Limit Exceeded if you don't print anything or forget to flush the output.

To flush you need to do the following right after printing a query and a line end:

* fflush(stdout) or cout.flush() in C++;
* System.out.flush() in Java;
* flush(output) in Pascal;
* stdout.flush() in Python;
* see documentation for other languages.

Example

Input

```
4 2
2
2
0
```

Output

```? 1 1? 1 1? 3 4! 0011
```

Note

For first query $1,1$, the interactor should flip $[1,1]$ or $[1,4]$. It chose to flip $[1,4]$, so the sequence became 1100.

For second query $1,1$, the interactor should flip $[1,1]$ or $[1,4]$. It again chose to flip $[1,4]$, so the sequence became 0011.

For third query $3,4$, the interactor should flip $[1,4]$ or $[3,4]$. It chose to flip $[3,4]$, so the sequence became 0000.

Q: How does interactor choose between $[1,r]$ and $[l,n]$? Is it really random?

A: The interactor will use a secret pseudorandom number generator. Only $s$ and your queries will be hashed and used as the seed. So if you give the same sequence of queries twice for the same secret string, you will get the same results. Except this, you can consider the choices fully random, like flipping a fair coin. You needn't (and shouldn't) exploit the exact generator to pass this problem.

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

static long long queries = 0;
static long long query_limit = 0;

static void log_metrics() {
    try {
        tout << "queries=" << queries << "\n";
        tout << "query_limit=" << query_limit << "\n";
        tout.flush();
    } catch (...) {

    }
}

static void finish(TResult verdict, const string& msg) {
    log_metrics();
    quitf(verdict, "%s", msg.c_str());
}

static bool parseLL(const string& s, long long& out) {
    if (s.empty()) return false;
    int i = 0;
    bool neg = false;
    if (s[0] == '-') {
        neg = true;
        i = 1;
        if ((int)s.size() == 1) return false;
    }
    long long val = 0;
    for (; i < (int)s.size(); i++) {
        if (s[i] < '0' || s[i] > '9') return false;
        int d = s[i] - '0';
        if (val > (LLONG_MAX - d) / 10) return false;
        val = val * 10 + d;
    }
    out = neg ? -val : val;
    return true;
}

static uint64_t splitmix64_next(uint64_t& x) {
    x += 0x9e3779b97f4a7c15ULL;
    uint64_t z = x;
    z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9ULL;
    z = (z ^ (z >> 27)) * 0x94d049bb133111ebULL;
    return z ^ (z >> 31);
}

static uint64_t hashString64(const string& s) {
    uint64_t h = 1469598103934665603ULL;
    for (unsigned char c : s) {
        h ^= (uint64_t)c;
        h *= 1099511628211ULL;
    }
    uint64_t x = h ^ 0x9e3779b97f4a7c15ULL;

    (void)splitmix64_next(x);
    return x;
}

int main(int argc, char** argv) {
    registerInteraction(argc, argv);
    atexit(log_metrics);

    try {
        int n = inf.readInt(1, 300, "n");
        string secret = inf.readToken();
        if ((int)secret.size() != n) finish(_pe, "Invalid hidden input: secret length mismatch");
        for (char c : secret) {
            if (c != '0' && c != '1') finish(_pe, "Invalid hidden input: non-binary character");
        }

        vector<int> cur(n, 0);
        int curOnes = 0;
        for (int i = 0; i < n; i++) {
            cur[i] = (secret[i] == '1') ? 1 : 0;
            curOnes += cur[i];
        }

        query_limit = 10000;
        const long long hard_cap = max(200000LL, 10LL * query_limit);

        log_metrics();

        cout << n << " " << curOnes << "\n";
        cout.flush();

        uint64_t rng_state = hashString64(secret) ^ (uint64_t)n ^ ((uint64_t)curOnes << 16);

        while (true) {
            string cmd;
            if (!(cin >> cmd)) {
                finish(_pe, "Unexpected EOF from contestant");
            }

            if (cmd == "?") {
                string sl, sr;
                if (!(cin >> sl >> sr)) finish(_pe, "Malformed query: expected two integers");
                long long l, r;
                if (!parseLL(sl, l) || !parseLL(sr, r)) finish(_pe, "Malformed query: non-integer l/r");
                if (!(1 <= l && l <= r && r <= n)) finish(_pe, "Query out of range");

                queries++;
                if (queries > hard_cap) finish(_pe, "Hard cap exceeded");

                rng_state ^= (uint64_t)queries * 0x9e3779b97f4a7c15ULL;
                rng_state ^= (uint64_t)l * 0xbf58476d1ce4e5b9ULL;
                rng_state ^= (uint64_t)r * 0x94d049bb133111ebULL;
                uint64_t coin = splitmix64_next(rng_state) & 1ULL;

                if (coin == 0) {

                    int R = (int)r;
                    for (int i = 0; i < R; i++) {
                        if (cur[i]) curOnes--;
                        else curOnes++;
                        cur[i] ^= 1;
                    }
                } else {

                    int L = (int)l - 1;
                    for (int i = L; i < n; i++) {
                        if (cur[i]) curOnes--;
                        else curOnes++;
                        cur[i] ^= 1;
                    }
                }

                cout << curOnes << "\n";
                cout.flush();

            } else if (cmd == "!") {
                string ans;
                if (!(cin >> ans)) finish(_pe, "Malformed answer: expected a binary string");
                if ((int)ans.size() != n) finish(_wa, "Wrong answer: length mismatch");
                for (char c : ans) {
                    if (c != '0' && c != '1') finish(_pe, "Malformed answer: non-binary character");
                }
                if (ans == secret) finish(_ok, "OK");
                finish(_wa, "Wrong answer");
            } else {
                finish(_pe, "Invalid command token");
            }
        }
    } catch (const std::exception& e) {
        finish(_pe, string("Interactor exception: ") + e.what());
    } catch (...) {
        finish(_pe, "Interactor unknown exception");
    }
    return 0;
}

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

static string makeBalancedBothEnds(int n, int t, int maxDiscrepancyStart = 1) {
    vector<int> a(n, -1);
    int l = 0, r = n - 1;
    int leftLen = 0, leftOnes = 0;
    int rightLen = 0, rightOnes = 0;
    int onesLeft = t;

    int D = maxDiscrepancyStart;
    const int D_LIMIT = 12;

    auto okPlace = [&](int side, int bit) -> bool {
        if (bit == 1 && onesLeft <= 0) return false;
        int placed = leftLen + rightLen;
        int remSlotsAfter = n - placed - 1;
        int onesAfter = onesLeft - bit;
        if (onesAfter < 0 || onesAfter > remSlotsAfter) return false;

        if (side == 0) {
            int newLen = leftLen + 1;
            int newOnes = leftOnes + bit;
            if (abs(newOnes * 2 - newLen) > D) return false;
        } else {
            int newLen = rightLen + 1;
            int newOnes = rightOnes + bit;
            if (abs(newOnes * 2 - newLen) > D) return false;
        }
        return true;
    };

    while (l <= r) {
        struct Cand {
            int side;
            int bit;
            int disc;
            int bias;
        };
        vector<Cand> cands;
        for (int side = 0; side < 2; side++) {
            if (l == r && side == 1) continue;
            for (int bit = 0; bit <= 1; bit++) {
                if (!okPlace(side, bit)) continue;
                int disc = 0;
                if (side == 0) {
                    disc = abs((leftOnes + bit) * 2 - (leftLen + 1));
                } else {
                    disc = abs((rightOnes + bit) * 2 - (rightLen + 1));
                }
                int placed = leftLen + rightLen;
                int remSlotsAfter = n - placed - 1;
                int onesAfter = onesLeft - bit;
                double need = (remSlotsAfter == 0 ? 0.0 : (double)onesAfter / (double)remSlotsAfter);
                int bias = (int)llround(fabs(need - 0.5) * 1000.0);
                cands.push_back({side, bit, disc, bias});
            }
        }

        if (cands.empty()) {
            if (D < D_LIMIT) {
                D++;
                continue;
            }

            for (int side = 0; side < 2; side++) {
                if (l == r && side == 1) continue;
                for (int bit = 0; bit <= 1; bit++) {
                    if (bit == 1 && onesLeft <= 0) continue;
                    int placed = leftLen + rightLen;
                    int remSlotsAfter = n - placed - 1;
                    int onesAfter = onesLeft - bit;
                    if (onesAfter < 0 || onesAfter > remSlotsAfter) continue;
                    int disc = 0;
                    cands.push_back({side, bit, disc, 0});
                }
            }
            if (cands.empty()) break;
        }

        int bestDisc = INT_MAX;
        for (auto &c : cands) bestDisc = min(bestDisc, c.disc);
        vector<Cand> best;
        for (auto &c : cands) if (c.disc == bestDisc) best.push_back(c);

        int bestBias = INT_MAX;
        for (auto &c : best) bestBias = min(bestBias, c.bias);
        vector<Cand> best2;
        for (auto &c : best) if (c.bias == bestBias) best2.push_back(c);

        Cand pick = best2[rnd.next(0, (int)best2.size() - 1)];
        if (pick.side == 0) {
            a[l++] = pick.bit;
            leftLen++;
            leftOnes += pick.bit;
        } else {
            a[r--] = pick.bit;
            rightLen++;
            rightOnes += pick.bit;
        }
        onesLeft -= pick.bit;
    }

    for (int i = 0; i < n; i++) {
        if (a[i] == -1) {
            int bit = (onesLeft > 0 ? 1 : 0);
            a[i] = bit;
            onesLeft -= bit;
        }
    }
    if (onesLeft != 0) {

        for (int i = 0; i < n && onesLeft != 0; i++) {
            if (onesLeft > 0 && a[i] == 0) {
                a[i] = 1;
                onesLeft--;
            } else if (onesLeft < 0 && a[i] == 1) {
                a[i] = 0;
                onesLeft++;
            }
        }
    }

    string s;
    s.reserve(n);
    for (int i = 0; i < n; i++) s.push_back(char('0' + a[i]));
    return s;
}

static int countOnes(const string &s) {
    int c = 0;
    for (char ch : s) c += (ch == '1');
    return c;
}

int main(int argc, char** argv) {
    registerGen(argc, argv, 1);

    string mode = opt<string>("mode", "non");
    int nOpt = opt<int>("n", 300);
    int tOpt = opt<int>("t", -1);
    int Dopt = opt<int>("D", 1);

    if (mode != "non" && mode != "adp") {
        quitf(_fail, "Unknown --mode: %s", mode.c_str());
    }

    int seed = atoi(argv[1]);

    int n = nOpt;
    int t = tOpt;
    string s;

    if (seed == 1) {

        n = 1;
        t = 0;
        s = "0";
    } else if (seed == 2) {

        n = 300;
        t = 0;
        s.assign(n, '0');
    } else if (seed == 3) {

        n = 300;
        t = 150;
        s.clear();
        s.reserve(n);
        for (int i = 0; i < n; i++) s.push_back((i % 2 == 0) ? '0' : '1');
    } else {

        n = max(1, min(300, nOpt));
        if (t == -1) {
            int base = n / 2;
            int skew = rnd.next(-2, 2);
            t = base + skew;
            if (t < 0) t = 0;
            if (t > n) t = n;
        } else {
            t = max(0, min(n, t));
        }

        if (rnd.next(0, 9) <= 7) {
            int near = n / 2 + rnd.next(-1, 1);
            t = max(0, min(n, near));
        }

        s = makeBalancedBothEnds(n, t, max(0, min(12, Dopt)));

        int cur = countOnes(s);
        if (cur != t) {
            vector<char> a(s.begin(), s.end());
            if (cur < t) {
                int need = t - cur;
                for (int i = n / 2, step = 0; need > 0 && step < n; step++) {
                    int idx = (i + (step % 2 == 0 ? step / 2 : -(step / 2 + 1)) + n) % n;
                    if (a[idx] == '0') { a[idx] = '1'; need--; }
                }
            } else {
                int need = cur - t;
                for (int i = n / 2, step = 0; need > 0 && step < n; step++) {
                    int idx = (i + (step % 2 == 0 ? step / 2 : -(step / 2 + 1)) + n) % n;
                    if (a[idx] == '1') { a[idx] = '0'; need--; }
                }
            }
            s.assign(a.begin(), a.end());
        }
    }

    if (mode == "non") {

        cout << n << "\n" << s << "\n";
    } else {

        if (t == -1) t = countOnes(s);
        cout << n << " " << t << "\n";
    }

    return 0;
}


This is an interactive problem.

Made in Heaven is a rather curious Stand. Of course, it is (arguably) the strongest Stand in existence, but it is also an ardent puzzle enjoyer. For example, it gave Qtaro the following problem recently:

Made in Heaven has $n$ hidden integers $a_1, a_2, \dots, a_n$ ($3 \le n \le 5000$, $1 \le a_i \le 4$). Qtaro must determine all the $a_i$ by asking Made in Heaven some queries of the following form:

* In one query Qtaro is allowed to give Made in Heaven three distinct indexes $i$, $j$ and $k$ ($1 \leq i, j, k \leq n$).
* If $a_i, a_j, a_k$ form the sides of a non-degenerate triangle$^\dagger$, Made in Heaven will respond with the area of this triangle.
* Otherwise, Made in Heaven will respond with $0$.

By asking at most $5500$ such questions, Qtaro must either tell Made in Heaven all the values of the $a_i$, or report that it is not possible to uniquely determine them.

Unfortunately due to the universe reboot, Qtaro is not as smart as Jotaro. Please help Qtaro solve Made In Heaven's problem.

 ——————————————————————

$^\dagger$ Three positive integers $a, b, c$ are said to form the sides of a non-degenerate triangle if and only if all of the following three inequalities hold:

* $a+b > c$,
* $b+c > a$,
* $c+a > b$.

Interaction

The interaction begins with reading $n$ ($3 \le n \le 5000$), the number of hidden integers.

To ask a question corresponding to the triple $(i, j, k)$ ($1 \leq i < j < k \leq n$), output "? $i$ $j$ $k$" without quotes. Afterward, you should read a single integer $s$.

* If $s = 0$, then $a_i$, $a_j$, and $a_k$ are not the sides of a non-degenerate triangle.
* Otherwise, $s = 16 \Delta^2$, where $\Delta$ is the area of the triangle. The area is provided in this format for your convenience so that you need only take integer input.

If the numbers $a_i$ cannot be uniquely determined print "! $-1$" without quotes. On the other hand, if you have determined all the values of $a_i$ print "! $a_1$ $a_2$ $\dots$ $a_n$" on a single line.

The interactor is non-adaptive. The hidden array $a_1, a_2, \dots, a_n$ is fixed beforehand and is not changed during the interaction process.

After printing a query do not forget to output the end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

* fflush(stdout) or cout.flush() in C++;
* System.out.flush() in Java;
* flush(output) in Pascal;
* stdout.flush() in Python;
* see the documentation for other languages.

Examples

Input

```
3

63
```

Output

```
? 1 2 3

! -1
```

Input

```
6

0

0

0

63

15

135
```

Output

```
? 1 2 3

? 2 3 4

? 4 5 6

? 1 5 6

? 3 5 6

? 1 2 4

! 3 2 1 4 2 2
```

Input

```
15

3

3

3

3

3

0
```

Output

```
? 1 2 3

? 4 6 7

? 8 9 10

? 11 12 13

? 13 14 15

? 4 5 6

! -1
```

Input

```
15

3

15

0

3

3

3
```

Output

```
? 1 2 3

? 3 4 5

? 4 5 6

? 7 8 9

? 10 11 12

? 13 14 15

! 1 1 1 2 2 4 1 1 1 1 1 1 1 1 1 1
```

Input

```
10

3

48

3

48

63

0
```

Output

```
? 1 3 5

? 4 6 8

? 1 5 9

? 6 8 10

? 4 2 6

? 7 10 8

! 1 3 1 2 1 2 4 2 1 2
```

Note

In the first example, the interaction process happens as follows:

|  |  |  |
| --- | --- | --- |
| Stdin | Stdout | Explanation |
| 3 |  | Read $n = 3$. There are $3$ hidden integers |
|  | ? 1 2 3 | Ask for the area formed by $a_1$, $a_2$ and $a_3$ |
| 63 |  | Received $16\Delta^2 = 63$. So the area $\Delta = \sqrt{\frac{63}{16}} \approx 1.984313$ |
|  | ! -1 | Answer that there is no unique array satisfying the queries. |

From the area received, we can deduce that the numbers that forms the triangle are either ($4$, $4$, $1$) or ($3$, $2$, $2$) (in some order). As there are multiple arrays of numbers that satisfy the queries, a unique answer cannot be found.

In the second example, the interaction process happens as follows:

|  |  |  |  |
| --- | --- | --- | --- |
| Step | Stdin | Stdout | Explanation |
| 1 | 6 |  | Read $n = 6$. There are $6$ hidden integers |
| 2 |  | ? 1 2 3 | Ask for the area formed by $a_1$, $a_2$ and $a_3$ |
| 3 | 0 |  | Does not form a non-degenerate triangle |
| 4 |  | ? 2 3 4 | Ask for the area formed by $a_2$, $a_3$ and $a_4$ |
| 5 | 0 |  | Does not form a non-degenerate triangle |
| 6 |  | ? 4 5 6 | Ask for the area formed by $a_4$, $a_5$ and $a_6$ |
| 7 | 0 |  | Does not form a non-degenerate triangle |
|  |
| 8 |  | ? 1 5 6 | Ask for the area formed by $a_1$, $a_5$ and $a_6$ |
| 9 | 63 |  | Received $16\Delta^2 = 63$. So the area $\Delta = \sqrt{\frac{63}{16}} \approx 1.984313$ |
| 10 |  | ? 3 5 6 | Ask for the area formed by $a_3$, $a_5$ and $a_6$ |
| 11 | 15 |  | Received $16\Delta^2 = 15$. So the area $\Delta = \sqrt{\frac{15}{16}} \approx 0.968245$ |
| 12 |  | ? 1 2 4 | Ask for the area formed by $a_3$, $a_5$ and $a_6$ |
| 13 | 135 |  | Received $16\Delta^2 = 135$. So the area $\Delta = \sqrt{\frac{135}{16}} \approx 2.904738$ |
| 14 |  | ! 3 2 1 4 2 2 | A unique answer is found, which is $a = [3, 2, 1, 4, 2, 2]$. |

From steps $10$ and $11$, we can deduce that the the multiset $\left\{a_3, a_5, a_6\right\}$ must be $\left\{2, 2, 1\right\}$.

From steps $8$ and $9$, the multiset $\left\{a_1, a_5, a_6\right\}$ must be either $\left\{4, 4, 1\right\}$ or $\left\{3, 2, 2\right\}$.

As $\left\{a_3, a_5, a_6\right\}$ and $\left\{a_1, a_5, a_6\right\}$ share $a_5$ and $a_6$, we conclude that $a_5 = a_6 = 2$, as well as $a_1 = 3$, $a_3 = 1$.

From steps $6$ and $7$, we know that $a_5 = a_6 = 2$, and $a_4$, $a_5$ and $a_6$ cannot form a non-degenerate triangle, hence $a_4 = 4$.

With all the known information, only $a_2 = 2$ satisfies the queries made in steps $2$, $3$, $4$, $5$, $12$ and $13$.

In the third example, one array that satisfies the queries is $[1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]$.

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

static long long queries = 0;
static long long query_limit = 5500;
static int n;
static vector<int> a;

static void log_metrics() {
    try {
        tout << "queries=" << queries << endl;
        tout << "query_limit=" << query_limit << endl;
    } catch (...) {

    }
}

static void finish(TResult verdict, const string& msg) {
    log_metrics();
    quitf(verdict, "%s", msg.c_str());
}

bool is_triangle(long long x, long long y, long long z) {
    if (x <= 0 || y <= 0 || z <= 0) return false;
    return (x + y > z) && (x + z > y) && (y + z > x);
}

long long get_val(long long x, long long y, long long z) {
    if (!is_triangle(x, y, z)) return 0;
    return (x + y + z) * (x + y - z) * (x - y + z) * (-x + y + z);
}

bool check_ambiguity() {
    array<int, 5> cnt{};
    for (int x : a) cnt[x]++;

    auto pair_exists = [&](const array<int, 5>& c, int u, int v) -> bool {
        if (u == v) return c[u] >= 2;
        return c[u] >= 1 && c[v] >= 1;
    };

    auto equal_on_present_pairs = [&](int x, int y, const array<int, 5>& rest) -> bool {
        for (int u = 1; u <= 4; u++) {
            for (int v = u; v <= 4; v++) {
                if (!pair_exists(rest, u, v)) continue;
                if (get_val(x, u, v) != get_val(y, u, v)) return false;
            }
        }
        return true;
    };

    for (int x = 1; x <= 4; x++) {
        if (cnt[x] == 0) continue;
        array<int, 5> rest = cnt;
        rest[x]--;
        for (int y = 1; y <= 4; y++) {
            if (y == x) continue;
            if (equal_on_present_pairs(x, y, rest)) return true;
        }
    }

    for (int x = 1; x <= 4; x++) {
        for (int y = x + 1; y <= 4; y++) {
            if (cnt[x] == 0 || cnt[y] == 0) continue;
            array<int, 5> rest = cnt;
            rest[x]--;
            rest[y]--;
            if (equal_on_present_pairs(x, y, rest)) return true;
        }
    }

    return false;
}

int main(int argc, char** argv) {
    registerInteraction(argc, argv);
    atexit(log_metrics);

    n = inf.readInt(3, 5000, "n");
    a.resize(n);
    for (int i = 0; i < n; i++) {
        a[i] = inf.readInt(1, 4, "a_i");
    }

    cout << n << endl;

    string token;
    while (cin >> token) {
        if (token.empty()) continue;

        if (token[0] == '!') {

            string first_val_str;
            if (token.size() > 1) {
                first_val_str = token.substr(1);
            } else {
                if (!(cin >> first_val_str)) finish(_pe, "Unexpected EOF after '!'");
            }

            if (first_val_str == "-1") {

                if (check_ambiguity()) {
                    finish(_ok, "Correctly identified ambiguity.");
                } else {
                    finish(_wa, "Claimed ambiguity but the array is uniquely determined.");
                }
            } else {

                vector<int> user_a;
                try {
                    user_a.push_back(stoi(first_val_str));
                } catch (...) {
                    finish(_pe, "Invalid integer format in answer.");
                }

                for (int i = 1; i < n; i++) {
                    int val;
                    if (!(cin >> val)) finish(_pe, "Unexpected EOF reading answer array.");
                    user_a.push_back(val);
                }

                if (user_a == a) {
                    finish(_ok, "Correct array.");
                } else {
                    finish(_wa, "Incorrect array.");
                }
            }
            return 0;
        } else {

            int i, j, k;

            if (token == "?") {
                if (!(cin >> i >> j >> k)) finish(_pe, "Invalid query format.");
            } else {

                try {
                    i = stoi(token);
                } catch (...) {
                    finish(_pe, "Expected '?' or integer query index.");
                }
                if (!(cin >> j >> k)) finish(_pe, "Invalid query format.");
            }

            queries++;

            if (queries % 100 == 0) log_metrics();
            if (queries > 200000) finish(_pe, "Hard query limit exceeded.");

            if (i < 1 || i > n || j < 1 || j > n || k < 1 || k > n) {
                finish(_pe, "Query indices out of range.");
            }
            if (i == j || j == k || i == k) {
                finish(_pe, "Query indices must be distinct.");
            }

            long long val = get_val(a[i-1], a[j-1], a[k-1]);
            cout << val << endl;
        }
    }

    finish(_pe, "Unexpected EOF.");
}

#include "testlib.h"
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char* argv[]) {
    registerGen(argc, argv, 1);

    string mode = opt<string>("mode", "non");

    int n_arg = opt<int>("n", -1);

    long long seed = 0;
    if (argc > 1) seed = atoll(argv[1]);

    int n;
    if (n_arg != -1) {
        n = n_arg;
    } else {

        if (seed == 1) n = 3;
        else if (seed == 2) n = 6;
        else if (seed == 3) n = 15;
        else if (seed == 4) n = 100;
        else {
            int p = rnd.next(100);
            if (p < 10) n = rnd.next(3, 20);
            else if (p < 50) n = rnd.next(21, 500);
            else n = rnd.next(4000, 5000);
        }
    }

    if (mode == "adp") {
        cout << n << endl;
        return 0;
    }

    vector<int> a(n);

    if (seed == 1 && n == 3) {

        a = {1, 4, 4};
    } else if (seed == 2 && n == 6) {

        a = {3, 2, 1, 4, 2, 2};
    } else if (seed == 3 && n == 15) {

        fill(a.begin(), a.end(), 3);
    } else {

        int strat = rnd.next(5);
        if (strat == 0) {

            for (int i = 0; i < n; ++i) a[i] = rnd.next(1, 4);
        } else if (strat == 1) {

            for (int i = 0; i < n; ++i) {
                if (rnd.next(100) < 60) a[i] = (rnd.next(2) ? 1 : 4);
                else a[i] = rnd.next(1, 4);
            }
        } else if (strat == 2) {

            for (int i = 0; i < n; ++i) {
                if (rnd.next(100) < 60) a[i] = (rnd.next(2) ? 2 : 3);
                else a[i] = rnd.next(1, 4);
            }
        } else if (strat == 3) {

            int u = rnd.next(1, 4);
            int v = rnd.next(1, 4);
            while (u == v) v = rnd.next(1, 4);
            for (int i = 0; i < n; ++i) a[i] = (rnd.next(2) ? u : v);
        } else {

            int bs = rnd.next(5, max(6, n / 5));
            int cur = rnd.next(1, 4);
            for (int i = 0; i < n; ++i) {
                if (i > 0 && i % bs == 0) cur = rnd.next(1, 4);
                a[i] = cur;
            }
        }
    }

    cout << n << endl;
    for (int i = 0; i < n; ++i) {
        cout << a[i] << (i == n - 1 ? "" : " ");
    }
    cout << endl;

    return 0;
}


This is an interactive problem.

You are given a tree — connected undirected graph without cycles. One vertex of the tree is special, and you have to find which one. You can ask questions in the following form: given an edge of the tree, which endpoint is closer to the special vertex, meaning which endpoint's shortest path to the special vertex contains fewer edges. You have to find the special vertex by asking the minimum number of questions in the worst case for a given tree.

Please note that the special vertex might not be fixed by the interactor in advance: it might change the vertex to any other one, with the requirement of being consistent with the previously given answers.

Input

You are given an integer $n$ ($2 \le n \le 100$) — the number of vertices in a tree.

The folloiwing $n-1$ lines contain two integers each, $u$ and $v$ ($1 \le u, v \le n$), that denote an edge in the tree connecting $u$ and $v$. It is guaranteed that the given edges form a tree.

Interaction

After reading the input data, one can start making queries. There are two possible queries:

1. "? $u$ $v$" — to ask for an edge $(u, v)$ ($1 \le u, v \le n$) which of the endpoints is closer to the special vertex. The answer to this query is one of the endpoints. Note that, $u$ and $v$ must be connected by an edge, and hence they can not have the same distance to the special vertex.
2. "! $u$" — to indicate that you found the special vertex. After the program does that, it must immediately terminate.

Do not forget to output the end of line and flush the output. Otherwise you will get Idleness limit exceeded verdict. To flush the output, you can use:

* fflush(stdout) or cout.flush() in C++;
* System.out.flush() in Java;
* flush(output) in Pascal;
* sys.stdout.flush() in Python;
* see documentation for other languages.

In case you ask more queries than needed in the worst case for a given tree, you will get verdict Wrong answer.

Examples

Input

```
5
1 2
2 3
3 4
4 5
3
2
1
```

Output

```
? 3 4
? 2 3
? 1 2
! 1
```

Input

```
5
2 1
3 1
4 1
5 1
1
1
4
```

Output

```
? 1 2
? 1 3
? 1 4
! 4
```

Note

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

static int queries = 0;
static int query_limit = 0;
static const int HARD_CAP = 2000;
static int N;
static vector<vector<int>> adj;
static int target = -1;
static set<pair<int, int>> edges_set;

void log_metrics() {
    try {
        tout << "queries=" << queries << endl;
        tout << "query_limit=" << query_limit << endl;
    } catch (...) {

    }
}

template <typename... Args>
void finish(TResult verdict, const char* fmt, Args... args) {
    log_metrics();
    quitf(verdict, fmt, args...);
}

vector<int> compute_dp(int u, int p, int& max_label) {
    vector<vector<int>> children_S;
    for (int v : adj[u]) {
        if (v == p) continue;
        children_S.push_back(compute_dp(v, u, max_label));
    }

    sort(children_S.begin(), children_S.end(), [](const vector<int>& a, const vector<int>& b) {
        return a > b;
    });

    vector<int> current_S;

    for (const auto& S_v : children_S) {
        int w = 1;
        while (true) {

            bool in_Sv = false;
            for (int r : S_v) {
                if (r == w) { in_Sv = true; break; }
            }
            if (in_Sv) {
                w++;
                continue;
            }

            vector<int> exposed;
            exposed.push_back(w);
            for (int r : S_v) {
                if (r > w) exposed.push_back(r);
            }

            bool clash = false;
            for (int e : exposed) {
                for (int s : current_S) {
                    if (e == s) {
                        clash = true;
                        break;
                    }
                }
                if (clash) break;
            }

            if (!clash) {

                if (w > max_label) max_label = w;

                for (int e : exposed) current_S.push_back(e);
                break;
            }
            w++;
        }
    }

    sort(current_S.rbegin(), current_S.rend());
    return current_S;
}

int calc_limit() {
    if (N < 2) return 0;
    int max_label = 0;
    compute_dp(1, -1, max_label);
    return max_label;
}

int get_dist(int start, int end_node) {
    if (start == end_node) return 0;
    queue<pair<int, int>> q;
    q.push({start, 0});
    vector<int> visited(N + 1, 0);
    visited[start] = 1;

    while (!q.empty()) {
        auto [u, d] = q.front();
        q.pop();
        if (u == end_node) return d;
        for (int v : adj[u]) {
            if (!visited[v]) {
                visited[v] = 1;
                q.push({v, d + 1});
            }
        }
    }
    return 1e9;
}

int main(int argc, char** argv) {
    registerInteraction(argc, argv);
    atexit(log_metrics);

    N = inf.readInt(2, 100, "n");
    adj.resize(N + 1);
    for (int i = 0; i < N - 1; ++i) {
        int u = inf.readInt(1, N, "u");
        int v = inf.readInt(1, N, "v");
        adj[u].push_back(v);
        adj[v].push_back(u);
        if (u > v) swap(u, v);
        edges_set.insert({u, v});
    }

    target = inf.readInt(1, N, "target");

    query_limit = calc_limit();
    log_metrics();

    cout << N << endl;
    for (auto e : edges_set) {
        cout << e.first << " " << e.second << endl;
    }
    cout.flush();

    while (true) {

        if (queries > HARD_CAP) {
            finish(_pe, "Hard query limit exceeded (%d)", HARD_CAP);
        }

        string token;
        cin >> token;
        if (cin.fail()) {
            finish(_pe, "Unexpected EOF or read error");
        }

        if (token == "!") {
            int guess;
            cin >> guess;
            if (cin.fail()) finish(_pe, "Expected integer after '!'");

            if (guess == target) {
                finish(_ok, "Correct! Found %d in %d queries (limit %d)", target, queries, query_limit);
            } else {
                finish(_wa, "Wrong guess: %d. Expected: %d", guess, target);
            }
        } else {

            int u, v;
            if (token == "?") {
                cin >> u >> v;
            } else {

                try {
                    u = stoi(token);
                } catch (...) {
                    finish(_pe, "Invalid token '%s'", token.c_str());
                }
                cin >> v;
            }
            if (cin.fail()) finish(_pe, "Invalid query format");

            if (u < 1 || u > N || v < 1 || v > N) {
                finish(_pe, "Vertices %d %d out of range [1, %d]", u, v, N);
            }
            int u_sorted = min(u, v);
            int v_sorted = max(u, v);
            if (edges_set.find({u_sorted, v_sorted}) == edges_set.end()) {
                finish(_pe, "Vertices %d and %d are not connected by an edge", u, v);
            }

            queries++;

            if (queries % 10 == 0) log_metrics();

            int dist_u = get_dist(u, target);
            int dist_v = get_dist(v, target);

            if (dist_u == dist_v) {
                finish(_pe, "Logic error: equal distance in tree");
            }

            int ans = (dist_u < dist_v ? u : v);
            cout << ans << endl;
        }
    }

    return 0;
}

#include "testlib.h"
#include <bits/stdc++.h>

using namespace std;

int n;
vector<vector<int>> adj;
vector<bool> candidates;
int candidates_count = 0;

static long long queries = 0;
static long long query_limit = 0;

static void log_metrics() {
    try {
        tout << "queries=" << queries << endl;
        tout << "query_limit=" << query_limit << endl;
    } catch (...) {

    }
}

static void finish(TResult verdict, const string& msg) {
    log_metrics();
    quitf(verdict, "%s", msg.c_str());
}

vector<int> get_dists(int start) {
    vector<int> d(n + 1, -1);
    queue<int> q;
    q.push(start);
    d[start] = 0;

    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int v : adj[u]) {
            if (d[v] == -1) {
                d[v] = d[u] + 1;
                q.push(v);
            }
        }
    }
    return d;
}

int main(int argc, char** argv) {

    registerInteraction(argc, argv);
    atexit(log_metrics);

    n = inf.readInt();
    adj.resize(n + 1);
    vector<pair<int, int>> edges_list;
    for (int i = 0; i < n - 1; ++i) {
        int u = inf.readInt();
        int v = inf.readInt();
        adj[u].push_back(v);
        adj[v].push_back(u);
        edges_list.push_back({u, v});
    }

    query_limit = n;

    cout << n << endl;
    for (auto& e : edges_list) {
        cout << e.first << " " << e.second << endl;
    }
    cout.flush();

    candidates.assign(n + 1, true);
    candidates_count = n;

    log_metrics();

    while (true) {
        string type;

        int c = cin.peek();
        while (c != EOF && isspace(c)) {
            cin.get();
            c = cin.peek();
        }
        if (c == EOF) {
            finish(_pe, "Unexpected EOF from contestant");
        }

        cin >> type;

        if (type == "!") {
            int guess;
            if (!(cin >> guess)) finish(_pe, "Invalid format for answer");

            if (guess < 1 || guess > n) finish(_wa, "Guess out of range");

            if (!candidates[guess]) {
                finish(_wa, "Guess is inconsistent with previous query answers");
            }

            if (candidates_count > 1) {
                finish(_wa, "Special vertex not uniquely identified; more queries needed");
            }

            finish(_ok, "Correct");
        }
        else if (type == "?") {
            int u, v;
            if (!(cin >> u >> v)) finish(_pe, "Invalid format for query");

            if (u < 1 || u > n || v < 1 || v > n) finish(_wa, "Query vertices out of range");

            bool edge_exists = false;
            for (int nb : adj[u]) {
                if (nb == v) {
                    edge_exists = true;
                    break;
                }
            }
            if (!edge_exists) finish(_wa, "Query edge does not exist");

            queries++;

            if (queries > 200000) finish(_pe, "Too many queries (hard cap exceeded)");

            vector<int> dist_u = get_dists(u);
            vector<int> dist_v = get_dists(v);

            int count_u = 0;
            int count_v = 0;
            vector<int> list_u, list_v;

            for (int i = 1; i <= n; ++i) {
                if (candidates[i]) {
                    if (dist_u[i] < dist_v[i]) {
                        count_u++;
                        list_u.push_back(i);
                    } else {
                        count_v++;
                        list_v.push_back(i);
                    }
                }
            }

            int reply = -1;

            if (count_u >= count_v) {
                reply = u;

                for (int x : list_v) candidates[x] = false;
                candidates_count = count_u;
            } else {
                reply = v;

                for (int x : list_u) candidates[x] = false;
                candidates_count = count_v;
            }

            if (candidates_count == 0) {
                finish(_wa, "Inconsistent state (interactor internal error)");
            }

            cout << reply << endl;
        }
        else {
            finish(_pe, "Invalid query type (expected '?' or '!')");
        }
    }

    return 0;
}

#include "testlib.h"
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char* argv[]) {

    registerGen(argc, argv, 1);

    string mode = opt<string>("mode", "non");

    int n = opt<int>("n", -1);

    long long seed_val = atoll(argv[1]);
    string type = "random";

    if (n == -1) {
        if (seed_val == 1) { n = 2; type = "random"; }
        else if (seed_val == 2) { n = 3; type = "line"; }
        else if (seed_val == 3) { n = 100; type = "line"; }
        else if (seed_val == 4) { n = 100; type = "star"; }
        else if (seed_val == 5) { n = 100; type = "binary"; }
        else if (seed_val == 6) { n = 100; type = "caterpillar"; }
        else {

            n = rnd.next(90, 100);
            if (rnd.next(5) == 0) n = rnd.next(2, 100);

            int t = rnd.next(1, 100);
            if (t <= 40) type = "random";
            else if (t <= 50) type = "line";
            else if (t <= 60) type = "star";
            else if (t <= 75) type = "binary";
            else if (t <= 90) type = "caterpillar";
            else type = "deep";
        }
    }

    vector<pair<int, int>> edges;
    if (n == 2) {
        edges.push_back({1, 2});
    } else {
        if (type == "line") {
            for (int i = 1; i < n; ++i) edges.push_back({i, i + 1});
        }
        else if (type == "star") {
            for (int i = 2; i <= n; ++i) edges.push_back({1, i});
        }
        else if (type == "binary") {

            for (int i = 2; i <= n; ++i) edges.push_back({i / 2, i});
        }
        else if (type == "caterpillar") {

            int len = rnd.next(n / 2, n - 1);
            if (len < 1) len = 1;

            for (int i = 1; i < len; ++i) edges.push_back({i, i + 1});

            for (int i = len + 1; i <= n; ++i) {
                int p = rnd.next(1, len);
                edges.push_back({p, i});
            }
        }
        else if (type == "deep") {

            for (int i = 2; i <= n; ++i) {
                int start = max(1, i - 2);
                int p = rnd.next(start, i - 1);
                edges.push_back({p, i});
            }
        }
        else {

            for (int i = 2; i <= n; ++i) {
                edges.push_back({rnd.next(1, i - 1), i});
            }
        }
    }

    vector<int> p(n + 1);
    iota(p.begin(), p.end(), 0);
    shuffle(p.begin() + 1, p.end());

    vector<pair<int, int>> final_edges;
    for (auto& e : edges) {
        final_edges.push_back({p[e.first], p[e.second]});
    }

    shuffle(final_edges.begin(), final_edges.end());

    println(n);
    for (auto& e : final_edges) {
        if (rnd.next(2)) println(e.first, e.second);
        else println(e.second, e.first);
    }

    if (mode == "non") {
        int target = rnd.next(1, n);
        println(target);
    }

    return 0;
}


This is an interactive problem.

The Department of Supernatural Phenomena at the Oxenfurt Academy has opened the Library of Magic, which contains the works of the greatest sorcerers of Redania — $n$ ($3 \leq n \leq 10^{18}$) types of books, numbered from $1$ to $n$. Each book's type number is indicated on its spine. Moreover, each type of book is stored in the library in exactly two copies! And you have been appointed as the librarian.

One night, you wake up to a strange noise and see a creature leaving the building through a window. Three thick tomes of different colors were sticking out of the mysterious thief's backpack. Before you start searching for them, you decide to compute the numbers $a$, $b$, and $c$ written on the spines of these books. All three numbers are distinct.

So, you have an unordered set of tomes, which includes one tome with each of the pairwise distinct numbers $a$, $b$, and $c$, and two tomes for all numbers from $1$ to $n$, except for $a$, $b$, and $c$. You want to find these values $a$, $b$, and $c$.

Since you are not working in a simple library, but in the Library of Magic, you can only use one spell in the form of a query to check the presence of books in their place:

* "xor l r" — Bitwise XOR query with parameters $l$ and $r$. Let $k$ be the number of such tomes in the library whose numbers are greater than or equal to $l$ and less than or equal to $r$. You will receive the result of the computation $v_1 \oplus v_2 \oplus... \oplus v_k$, where $v_1... v_k$ are the numbers on the spines of these tomes, and $\oplus$ denotes the operation of bitwise exclusive OR.

Since your magical abilities as a librarian are severely limited, you can make no more than $150$ queries.

Input

The first line of input contains an integer $t$ ($1 \le t \le 300$) — the number of test cases.

The first line of each test case contains a single integer $n$ ($3 \leq n \leq 10^{18}$) — the number of types of tomes.

Interaction

The interaction for each test case begins with reading the integer $n$.

Then you can make up to $150$ queries.

To make a query, output a string in the format "xor l r" (without quotes) ($1 \leq l \leq r \leq n$). After each query, read an integer — the answer to your query.

To report the answer, output a string in the format "ans a b c" (without quotes), where $a$, $b$, and $c$ are the numbers you found as the answer to the problem. You can output them in any order.

The interactor is not adaptive, which means that the answer is known before the participant makes queries and does not depend on the queries made by the participant.

After making $150$ queries, the answer to any other query will be $-1$. Upon receiving such an answer, terminate the program to receive a verdict of "WA" (Wrong answer).

After outputting a query, do not forget to output a newline and flush the output buffer. Otherwise, you will receive a verdict of "IL" (Idleness limit exceeded). To flush the buffer, use:

* fflush(stdout) or cout.flush() in C++;
* System.out.flush() in Java;
* flush(output) in Pascal;
* stdout.flush() in Python;
* refer to the documentation for other languages.

Example

Input

```
2
6

0

2

3

5

3
```

Output

```
xor 1 1

xor 2 2

xor 3 3

xor 4 6

ans 2 3 5

ans 1 2 3
```

Note

In the first test case, the books in the library after the theft look like this:![](https://espresso.codeforces.com/68391415c7555737d5c6224fa63d1891c2bd552e.png)

Now consider the answers to the queries:

* For the query "xor 1 1", you receive the result $1 \oplus 1 = 0$. Two tomes satisfy the condition specified in the query — both with the number $1$.
* For the query "xor 2 2", you receive the result $2$, as only one tome satisfies the specified condition.
* For the query "xor 3 3", you receive the result $3$.
* For the query "xor 4 6", you receive the result $4 \oplus 6 \oplus 4 \oplus 5 \oplus 6 = 5$.

In the second test case, there are only $3$ types of books, and it is easy to guess that the missing ones have the numbers $1$, $2$, and $3$.

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

static long long queries = 0;
static long long query_limit = 0;

static void log_metrics() {
    try {
        tout << "queries=" << queries << "\n";
        tout << "query_limit=" << query_limit << "\n";
        tout.flush();
    } catch (...) {

    }
}

static void finish(TResult verdict, const string& msg) {
    log_metrics();
    quitf(verdict, "%s", msg.c_str());
}

static bool readLongLongFromCin(long long &out) {

    cin >> out;
    return (bool)cin;
}

int main(int argc, char** argv) {
    registerInteraction(argc, argv);
    atexit(log_metrics);

    long long t = 0;
    try {
        t = inf.readLong();
    } catch (...) {

        query_limit = 0;
        log_metrics();
        return 0;
    }
    if (t < 1 || t > 300) {
        query_limit = 0;
        log_metrics();
        quitf(_fail, "Invalid t in hidden input: %lld", t);
    }

    struct CaseData {
        long long n, a, b, c;
    };
    vector<CaseData> cases;
    cases.reserve((size_t)t);

    for (long long i = 0; i < t; i++) {
        long long n = inf.readLong();
        long long a = inf.readLong();
        long long b = inf.readLong();
        long long c = inf.readLong();
        cases.push_back({n, a, b, c});
    }

    query_limit = 150LL * t;
    log_metrics();

    const long long hard_cap = max(200000LL, 10LL * query_limit);

    cout << t << "\n";
    cout.flush();

    for (long long tc = 0; tc < t; tc++) {
        const long long n = cases[tc].n;
        const long long A = cases[tc].a;
        const long long B = cases[tc].b;
        const long long C = cases[tc].c;

        if (!(3LL <= n && n <= 1000000000000000000LL)) finish(_fail, "Invalid n in hidden input");
        auto inRange = [&](long long x) { return 1LL <= x && x <= n; };
        if (!inRange(A) || !inRange(B) || !inRange(C) || A == B || A == C || B == C)
            finish(_fail, "Invalid (a,b,c) in hidden input");

        cout << n << "\n";
        cout.flush();

        long long case_queries = 0;
        while (true) {
            if (queries > hard_cap) finish(_pe, "Hard cap exceeded");

            string cmd;
            if (!(cin >> cmd)) finish(_pe, "Unexpected EOF from contestant");

            if (cmd == "xor") {
                long long l, r;
                if (!readLongLongFromCin(l) || !readLongLongFromCin(r))
                    finish(_pe, "Malformed xor query (expected two integers)");

                if (!(1LL <= l && l <= r && r <= n))
                    finish(_pe, "Invalid xor query bounds");

                queries++;
                case_queries++;

                if (case_queries > 150) {
                    cout << -1 << "\n";
                    cout.flush();
                    continue;
                }

                long long res = 0;
                if (l <= A && A <= r) res ^= A;
                if (l <= B && B <= r) res ^= B;
                if (l <= C && C <= r) res ^= C;

                cout << res << "\n";
                cout.flush();
            } else if (cmd == "ans") {
                long long x, y, z;
                if (!readLongLongFromCin(x) || !readLongLongFromCin(y) || !readLongLongFromCin(z))
                    finish(_pe, "Malformed ans (expected three integers)");

                if (!inRange(x) || !inRange(y) || !inRange(z) || x == y || x == z || y == z)
                    finish(_wa, "Invalid answer values");

                array<long long, 3> got = {x, y, z};
                array<long long, 3> want = {A, B, C};
                sort(got.begin(), got.end());
                sort(want.begin(), want.end());

                if (got != want) finish(_wa, "Wrong answer");

                if (tc + 1 == t) finish(_ok, "OK");
                break;
            } else {
                finish(_pe, "Unknown command (expected 'xor' or 'ans')");
            }
        }
    }

    finish(_pe, "Contestant did not finish all testcases");
    return 0;
}

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

static long long highestPow2LE(long long n) {
    long long p = 1;
    while ((p << 1) > 0 && (p << 1) <= n) p <<= 1;
    return p;
}

static long long pickNotIn(long long n, const vector<long long>& used) {
    while (true) {
        long long x = rnd.next(1LL, n);
        bool ok = true;
        for (long long u : used) if (x == u) { ok = false; break; }
        if (ok) return x;
    }
}

static void ensureDistinctInRange(long long n, long long &a, long long &b, long long &c) {
    auto inRange = [&](long long x) { return 1LL <= x && x <= n; };
    if (!inRange(a)) a = rnd.next(1LL, n);
    if (!inRange(b)) b = rnd.next(1LL, n);
    if (!inRange(c)) c = rnd.next(1LL, n);

    if (a == b) b = pickNotIn(n, {a});
    if (a == c) c = pickNotIn(n, {a, b});
    if (b == c) c = pickNotIn(n, {a, b});
}

static void genTriple(long long n, long long seed, long long &a, long long &b, long long &c) {

    if (seed == 1) {
        a = 1; b = 2; c = 3;
        return;
    }
    if (seed == 2) {
        a = 1;
        b = n - 1;
        c = n;
        return;
    }
    if (seed == 3) {
        long long x = (1LL << 58);
        a = 1;
        b = x;
        c = x + 1;
        if (c > n) {

            a = n;
            b = n - 1;
            c = 1;
        }
        return;
    }

    int type = rnd.next(0, 99);

    if (type < 50) {

        long long k = highestPow2LE(n);
        a = k;
        b = k - 1;
        c = 1;
        if (k <= 2) {

            a = 1; b = 2; c = 3;
        } else if (b == c) {
            c = 2;
        }
        ensureDistinctInRange(n, a, b, c);
        return;
    }

    if (type < 75) {

        bool ok = false;
        for (int it = 0; it < 200; it++) {
            long long x = rnd.next(1LL, n);
            long long y = rnd.next(1LL, n);
            if (x == y) continue;
            long long z = x ^ y;
            if (1LL <= z && z <= n && z != x && z != y) {
                a = x; b = y; c = z;
                ok = true;
                break;
            }
        }
        if (ok) return;

    }

    long long third1 = max(1LL, n / 3);
    long long third2 = max(third1 + 1, (2 * n) / 3);

    a = rnd.next(1LL, third1);
    b = rnd.next(min(third1 + 1, n), min(third2, n));
    c = rnd.next(min(third2 + 1, n), n);

    ensureDistinctInRange(n, a, b, c);
}

int main(int argc, char** argv) {
    registerGen(argc, argv, 1);

    string mode = opt<string>("mode", "non");
    long long fixedN = opt<long long>("n", 0LL);
    long long nmin = opt<long long>("nmin", 3LL);
    long long nmax = opt<long long>("nmax", 1000000000000000000LL);

    ensuref(nmin >= 3, "nmin must be >= 3");
    ensuref(nmax >= nmin, "nmax must be >= nmin");

    long long seed = 1;
    if (argc > 1) seed = atoll(argv[1]);

    long long n;
    if (fixedN != 0) {
        n = fixedN;
    } else if (seed == 1) {
        n = 3;
    } else if (seed == 2) {
        n = 1000000000000000000LL;
    } else if (seed == 3) {
        n = 999999999999999937LL;
    } else {
        long long span = nmax - nmin;
        long long delta = 0;
        if (span > 0) delta = rnd.next(0LL, min(1000000LL, span));
        n = nmax - delta;
        if (n < nmin) n = nmin;
        if (n > nmax) n = nmax;
    }

    ensuref(3LL <= n && n <= 1000000000000000000LL, "n out of bounds");

    if (mode == "non") {
        long long a = 1, b = 2, c = 3;
        genTriple(n, seed, a, b, c);
        ensureDistinctInRange(n, a, b, c);
        ensuref(a != b && a != c && b != c, "a,b,c must be distinct");
        cout << 1 << "\n";
        cout << n << "\n";
        cout << a << " " << b << " " << c << "\n";
        return 0;
    }

    if (mode == "adp") {

        cout << 1 << "\n";
        cout << n << "\n";
        return 0;
    }

    quitf(_fail, "Unknown --mode (expected non/adp): %s", mode.c_str());
}


This is an interactive problem.

There is a hidden permutation $p_1, p_2, \dots, p_n$.

Consider an undirected graph with $n$ nodes only with no edges. You can make two types of queries:

1. Specify an integer $x$ satisfying $2 \le x \le 2n$. For all integers $i$ ($1 \le i \le n$) such that $1 \le x-i \le n$, an edge between node $i$ and node $x-i$ will be added.
2. Query the number of edges in the shortest path between node $p_i$ and node $p_j$. As the answer to this question you will get the number of edges in the shortest path if such a path exists, or $-1$ if there is no such path.

Note that you can make both types of queries in any order.

Within $2n$ queries (including type $1$ and type $2$), guess two possible permutations, at least one of which is $p_1, p_2, \dots, p_n$. You get accepted if at least one of the permutations is correct. You are allowed to guess the same permutation twice.

A permutation of length $n$ is an array consisting of $n$ distinct integers from $1$ to $n$ in arbitrary order. For example, $[2,3,1,5,4]$ is a permutation, but $[1,2,2]$ is not a permutation ($2$ appears twice in the array), and $[1,3,4]$ is also not a permutation ($n=3$ but there is $4$ in the array).

Input

Each test contains multiple test cases. The first line contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases.

The first line of each test case contains a single integer $n$ ($2 \le n \le 10^3$) — the length of the permutation.

It is guaranteed that the sum of $n$ over all test cases does not exceed $10^3$.

Interaction

The interaction for each test case begins by reading the integer $n$.

Then, make at most $2n$ queries:

* If you want to make a type $1$ query, output "+ x". $x$ must be an integer between $2$ and $2n$ inclusive. After doing that read $1$ or $-2$. If you read $1$ your query was valid, otherwise it was invalid or you exceed the limit of queries, and your program must terminate immediately to receive a Wrong Answer verdict.
* If you want to make a type $2$ query, output "? i j". $i$ and $j$ must be integers between $1$ and $n$ inclusive. After that, read in a single integer $r$ ($-1 \le r \le n$) — the answer to your query. If you receive the integer $−2$ instead of an answer, it means your program has made an invalid query, or has exceeded the limit of queries. Your program must terminate immediately to receive a Wrong Answer verdict.

At any point of the interaction, if you want to guess two permutations, output "! $p_{1,1}$ $p_{1,2}$ $\dots$ $p_{1,n}$ $p_{2,1}$ $p_{2,2}$ $\dots$ $p_{2,n}$". Note that you should output the two permutations on the same line, and no exclamation mark is needed to separate the two permutations. After doing that read $1$ or $-2$. If you read $1$ your answer was correct, otherwise it was incorrect and your program must terminate immediately to receive a Wrong Answer verdict. After that, move on to the next test case, or terminate the program if there are none. Note that reporting the answer does not count as a query.

Note that even if you output a correct permutation, the second permutation should be a permutation and not an arbitrary array.

At any point, if you continue interaction after reading in the integer $-2$, you can get an arbitrary verdict because your solution will continue to read from a closed stream.

After printing a query or the answer do not forget to output the end of line and flush the output. Otherwise, you will get Idleness limit exceeded. To do this, use:

* fflush(stdout) or cout.flush() in C++;
* System.out.flush() in Java;
* flush(output) in Pascal;
* stdout.flush() in Python;
* see the documentation for other languages.

Interactor is non-adaptive. This means that all permutations are fixed before the interaction starts.

Example

Input

```
2
6

1

1

1

1

1

2

-1

1
2

1
```

Output

```
+ 12

+ 2

+ 3

? 1 3

+ 5

? 1 5

? 4 5

! 1 4 2 5 3 6 1 2 3 4 5 6

! 1 2 2 1
```

Note

In the first test case, $n=6$ and the hidden permutation $p = [1,4,2,5,3,6]$.

Firstly, make a type $1$ query on $x=12, 2, 3$ respectively. This adds four edges to the graph in total:

* An edge that connects node $6$ and node $6$.
* An edge that connects node $1$ and node $1$.
* An edge that connects node $1$ and node $2$.
* An edge that connects node $2$ and node $1$.

Since all of these queries are valid, the interactor returns $1$ after each of them.

Then, query the number of edges in the shortest path between node $p_1 = 1$ and $p_3 = 2$, which is equal to $1$.

Then, make a type $1$ query on $x=5$. This adds four edges to the graph in total:

* An edge that connects node $1$ and node $4$.
* An edge that connects node $2$ and node $3$.
* An edge that connects node $3$ and node $2$.
* An edge that connects node $4$ and node $1$.

Since this query is valid, the interactor returns $1$.

Then, query the number of edges in the shortest path between node $p_1 = 1$ and $p_5 = 3$, which is equal to $2$.

Then, query the number of edges in the shortest path between node $p_4 = 5$ and $p_5 = 3$. Such a path doesn't exist, therefore the interactor returns $-1$.

Afterwards, due to some magic, two possible permutations that can be $p$ are determined: the first permutation is $[1,4,2,5,3,6]$ and the second permutation is $[1,2,3,4,5,6]$. Since the first permutation is equal to the hidden permutation, this test case is solved correctly. In total, $7$ queries are used, which is within the limit of $2 \cdot 6 = 12$ queries.

Since the answer is correct, the interactor returns $1$.

In the second test case, $n=2$ and the hidden permutation is $p = [2,1]$.

Since there are only $2! = 2$ possible permutations, no queries are needed. It is sufficient to just output the two permutations, $[1,2]$ and $[2,1]$. In total, $0$ queries are used, which is within the limit of $2 \cdot 2 = 4$ queries.

Since the answer is correct, the interactor returns $1$.

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

static long long queries = 0;
static long long query_limit = 0;

static void log_metrics() {

    if (query_limit == 0 && queries == 0) return;
    try {
        tout << "queries=" << queries << endl;
        tout << "query_limit=" << query_limit << endl;
    } catch (...) {

    }
}

static void finish(TResult verdict, const string& msg) {
    log_metrics();
    quitf(verdict, "%s", msg.c_str());
}

int main(int argc, char** argv) {
    registerInteraction(argc, argv);
    atexit(log_metrics);

    int t = inf.readInt();

    cout << t << endl;

    while (t--) {
        int n = inf.readInt();

        query_limit += 2 * n;

        vector<int> p(n);
        for (int i = 0; i < n; ++i) {
            p[i] = inf.readInt();
        }

        cout << n << endl;

        vector<vector<int>> adj(n + 1);
        vector<vector<bool>> has_edge(n + 1, vector<bool>(n + 1, false));

        bool solved = false;
        while (!solved) {

            if (queries > 200000) {
                finish(_pe, "Hard query limit exceeded (200000)");
            }

            string token;

            if (!(cin >> token)) {
                finish(_wa, "Unexpected end of input from solution");
            }

            if (token == "+") {

                int x;
                if (!(cin >> x)) finish(_wa, "Expected integer x after '+'");

                queries++;

                if (x < 2 || x > 2 * n) {
                    finish(_wa, format("x=%d out of range [2, %d]", x, 2 * n));
                }

                for (int i = 1; i <= n; ++i) {
                    int j = x - i;
                    if (j >= 1 && j <= n) {

                        if (!has_edge[i][j]) {
                            has_edge[i][j] = true;
                            has_edge[j][i] = true;
                            adj[i].push_back(j);
                            adj[j].push_back(i);
                        }
                    }
                }

                cout << 1 << endl;

            } else if (token == "?") {

                int i, j;
                if (!(cin >> i >> j)) finish(_wa, "Expected integers i j after '?'");

                queries++;

                if (i < 1 || i > n || j < 1 || j > n) {
                    finish(_wa, format("Indices (%d, %d) out of range [1, %d]", i, j, n));
                }

                int u = p[i - 1];
                int v = p[j - 1];

                if (u == v) {

                    cout << 0 << endl;
                } else {

                    queue<pair<int, int>> q;
                    q.push({u, 0});

                    vector<int> dist(n + 1, -1);
                    dist[u] = 0;

                    int result = -1;
                    while (!q.empty()) {
                        auto [curr, d] = q.front();
                        q.pop();

                        if (curr == v) {
                            result = d;
                            break;
                        }

                        for (int neighbor : adj[curr]) {
                            if (dist[neighbor] == -1) {
                                dist[neighbor] = d + 1;
                                q.push({neighbor, d + 1});
                            }
                        }
                    }
                    cout << result << endl;
                }

            } else if (token == "!") {

                vector<int> guess1(n), guess2(n);

                auto read_and_validate = [&](vector<int>& out_vec) -> bool {
                    vector<bool> seen(n + 1, false);
                    for (int k = 0; k < n; ++k) {
                        if (!(cin >> out_vec[k])) return false;
                        if (out_vec[k] < 1 || out_vec[k] > n) return false;
                        if (seen[out_vec[k]]) return false;
                        seen[out_vec[k]] = true;
                    }
                    return true;
                };

                if (!read_and_validate(guess1)) finish(_wa, "Invalid permutation format (guess 1)");
                if (!read_and_validate(guess2)) finish(_wa, "Invalid permutation format (guess 2)");

                bool match1 = (guess1 == p);
                bool match2 = (guess2 == p);

                if (match1 || match2) {
                    cout << 1 << endl;
                    solved = true;
                } else {
                    finish(_wa, "Neither guessed permutation is correct");
                }

            } else {
                finish(_wa, format("Unknown query token '%s'", token.c_str()));
            }
        }
    }

    finish(_ok, "All test cases passed");
    return 0;
}

#include "testlib.h"
#include <bits/stdc++.h>

using namespace std;

int main(int argc, char* argv[]) {
    registerGen(argc, argv, 1);

    string mode = opt<string>("mode", "non");

    int seed_val = -1;
    try {
        if (argc > 1) seed_val = stoi(argv[1]);
    } catch (...) {
        seed_val = -1;
    }

    const int MAX_SUM = 1000;
    const int MAX_T = 100;
    vector<int> ns;

    if (seed_val == 1) {

        ns.push_back(MAX_SUM);
    } else if (seed_val == 2) {

        int current_sum = 0;
        while (current_sum + 2 <= MAX_SUM && ns.size() < MAX_T) {
            ns.push_back(2);
            current_sum += 2;
        }
    } else if (seed_val == 3) {

        int current_sum = 0;
        while (current_sum + 2 <= MAX_SUM && ns.size() < MAX_T) {
            int rem = MAX_SUM - current_sum;

            int n = rnd.next(2, min(rem, 20));

            if (rem - n == 1) n++;

            ns.push_back(n);
            current_sum += n;
        }
    } else {

        int type = rnd.next(3);

        if (type == 0) {

            ns.push_back(MAX_SUM);
        } else {

            int limit_upper = (type == 1) ? 200 : 50;
            int current_sum = 0;

            while (current_sum + 2 <= MAX_SUM && ns.size() < MAX_T) {
                int rem = MAX_SUM - current_sum;
                int n = rnd.next(2, min(rem, limit_upper));

                if (rem - n == 1) n++;

                ns.push_back(n);
                current_sum += n;
            }

        }
    }

    cout << ns.size() << endl;
    for (int n : ns) {
        cout << n << endl;
        if (mode == "non") {

            vector<int> p(n);
            iota(p.begin(), p.end(), 1);
            shuffle(p.begin(), p.end());
            for (int i = 0; i < n; i++) {
                cout << p[i] << (i == n - 1 ? "" : " ");
            }
            cout << endl;
        }

    }

    return 0;
}