This is an interactive problem.

Consider an undirected connected graph consisting of $n$ vertices and $m$ edges. Each vertex can be colored with one of three colors: $1$, $2$, or $3$. Initially, all vertices are uncolored.

Alice and Bob are playing a game consisting of $n$ rounds. In each round, the following two-step process happens:

1. Alice chooses two different colors.
2. Bob chooses an uncolored vertex and colors it with one of the two colors chosen by Alice.

Alice wins if there exists an edge connecting two vertices of the same color. Otherwise, Bob wins.

You are given the graph. Your task is to decide which player you wish to play as and win the game.

Input

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

The first line of each test case contains two integers $n$, $m$ ($1 \le n \le 10^4$, $n - 1 \le m \le \min(\frac{n \cdot (n - 1)}{2}, 10^4)$) — the number of vertices and the number of edges in the graph, respectively.

Each of the next $m$ lines of each test case contains two integers $u_i$, $v_i$ ($1 \le u_i, v_i \le n$) — the edges of the graph. It is guaranteed that the graph is connected and there are no multiple edges or self-loops.

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

Interaction

For each test case, you need to output a single line containing either "Alice" or "Bob", representing the player you choose.

Then for each of the following $n$ rounds, the following two-step process happens:

1. Alice (either you or the interactor) will output two integers $a$ and $b$ ($1 \le a, b \le 3$, $a \neq b$) — the colors chosen by Alice.
2. Bob (either you or the interactor) will output two integers $i$ and $c$ ($1 \le i \le n$, $c = a$ or $c = b$) — the vertex and the color chosen by Bob. Vertex $i$ must be a previously uncolored vertex.

If any of your outputs are invalid, the jury will output "-1" and you will receive a Wrong Answer verdict.

At the end of all $n$ turns, if you have lost the game, the jury will output "-1" and you will receive a Wrong Answer verdict.

If your program has received a $-1$ instead of a valid value, it must terminate immediately. Otherwise, you may receive an arbitrary verdict because your solution might be reading from a closed stream.

Note that if you are playing as Alice, and there already exists an edge connected two vertices of the same color, the interactor will not terminate early and you will keep playing all $n$ rounds.

After outputting, 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 documentation for other languages.

Example

Input

```
2
3 3
1 2
2 3
3 1

3 1

2 2

1 1
4 4
1 2
2 3
3 4
4 1

2 3

1 2

2 1

3 1
```

Output

```
Alice
3 1

1 2

2 1

Bob

1 2

2 1

4 1

3 3
```

Note

Note that the sample test cases are example games and do not necessarily represent the optimal strategy for both players.

In the first test case, you choose to play as Alice.

1. Alice chooses two colors: $3$ and $1$. Bob chooses vertex $3$ and colors it with color $1$.
2. Alice chooses two colors: $1$ and $2$. Bob chooses vertex $2$ and colors it with color $2$.
3. Alice chooses two colors: $2$ and $1$. Bob chooses vertex $1$ and colors it with color $1$.

Alice wins because the edge $(3, 1)$ connects two vertices of the same color.

In the second test case, you choose to play as Bob.

1. Alice chooses two colors: $2$ and $3$. Bob chooses vertex $1$ and colors it with color $2$.
2. Alice chooses two colors: $1$ and $2$. Bob chooses vertex $2$ and colors it with color $1$.
3. Alice chooses two colors: $2$ and $1$. Bob chooses vertex $4$ and colors it with color $1$.
4. Alice chooses two colors: $3$ and $1$. Bob chooses vertex $3$ and colors it with color $3$.

Bob wins because there are no edges with vertices of the same color.

#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 void send_minus_one_and_flush() {
    cout << "-1\n";
    cout.flush();
}

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

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

static bool readIntManual(long long& x) {
    string s;
    if (!readToken(s)) return false;
    return parseLL(s, x);
}

struct TestCaseData {
    int n = 0, m = 0;
    vector<pair<int,int>> edges;
    vector<vector<int>> adj;

    bool bip = true;
    vector<int> part;
    vector<int> side0, side1;
};

static TestCaseData readCase() {
    TestCaseData tc;
    tc.n = inf.readInt();
    tc.m = inf.readInt();
    tc.edges.reserve(tc.m);
    tc.adj.assign(tc.n + 1, {});
    for (int i = 0; i < tc.m; i++) {
        int u = inf.readInt();
        int v = inf.readInt();
        if (u < 1 || u > tc.n || v < 1 || v > tc.n || u == v) {
            quitf(_fail, "Invalid hidden input edge.");
        }
        tc.edges.push_back({u, v});
        tc.adj[u].push_back(v);
        tc.adj[v].push_back(u);
    }

    tc.part.assign(tc.n + 1, -1);
    queue<int> q;
    tc.bip = true;
    for (int s = 1; s <= tc.n; s++) {
        if (tc.part[s] != -1) continue;
        tc.part[s] = 0;
        q.push(s);
        while (!q.empty()) {
            int v = q.front();
            q.pop();
            for (int to : tc.adj[v]) {
                if (tc.part[to] == -1) {
                    tc.part[to] = tc.part[v] ^ 1;
                    q.push(to);
                } else if (tc.part[to] == tc.part[v]) {
                    tc.bip = false;
                }
            }
        }
    }

    if (tc.bip) {
        tc.side0.reserve(tc.n);
        tc.side1.reserve(tc.n);
        for (int i = 1; i <= tc.n; i++) {
            if (tc.part[i] == 0) tc.side0.push_back(i);
            else tc.side1.push_back(i);
        }
    }
    return tc;
}

static bool causesImmediateMono(const vector<vector<int>>& adj, const vector<int>& color, int v, int c) {
    for (int to : adj[v]) {
        if (color[to] == c) return true;
    }
    return false;
}

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

    try {
        int t = inf.readInt();
        if (t < 1 || t > 1000) quitf(_fail, "Invalid hidden t.");

        vector<TestCaseData> cases;
        cases.reserve(t);

        long long totalN = 0;
        for (int tc = 0; tc < t; tc++) {
            auto data = readCase();
            totalN += data.n;
            cases.push_back(std::move(data));
        }

        query_limit = totalN;
        log_metrics();

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

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

        for (int tcIdx = 0; tcIdx < t; tcIdx++) {
            const auto& tc = cases[tcIdx];

            cout << tc.n << " " << tc.m << "\n";
            for (auto [u, v] : tc.edges) {
                cout << u << " " << v << "\n";
            }
            cout.flush();

            string role;
            if (!readToken(role)) {
                finish(_pe, "Unexpected EOF while reading role.");
            }
            if (role != "Alice" && role != "Bob") {
                send_minus_one_and_flush();
                finish(_pe, "Invalid role (expected Alice/Bob).");
            }

            vector<int> color(tc.n + 1, 0);
            vector<char> colored(tc.n + 1, 0);
            int coloredCnt = 0;
            bool aliceWins = false;

            auto applyColor = [&](int v, int c) {
                colored[v] = 1;
                color[v] = c;
                coloredCnt++;
                for (int to : tc.adj[v]) {
                    if (color[to] == c) aliceWins = true;
                }
            };

            if (role == "Alice") {

                vector<int> st0, st1;
                if (tc.bip) {
                    st0 = tc.side0;
                    st1 = tc.side1;
                }
                vector<int> all;
                set<int> uncolored;
                if (!tc.bip) {
                    for (int i = 1; i <= tc.n; i++) uncolored.insert(i);
                } else {

                    for (int i = 1; i <= tc.n; i++) uncolored.insert(i);
                }

                for (int round = 1; round <= tc.n; round++) {
                    long long aLL, bLL;
                    if (!readIntManual(aLL) || !readIntManual(bLL)) {
                        finish(_pe, "Unexpected EOF while reading Alice move.");
                    }
                    int a = (int)aLL, b = (int)bLL;
                    if (!(1 <= a && a <= 3 && 1 <= b && b <= 3) || a == b) {
                        send_minus_one_and_flush();
                        finish(_pe, "Invalid Alice colors.");
                    }

                    int v = -1, c = -1;

                    if (tc.bip) {
                        bool has1 = (a == 1 || b == 1);
                        bool has2 = (a == 2 || b == 2);
                        bool has3 = (a == 3 || b == 3);

                        if (has1 && has2) {
                            if (!st0.empty()) { v = st0.back(); st0.pop_back(); c = 1; }
                            else if (!st1.empty()) { v = st1.back(); st1.pop_back(); c = 2; }
                        } else if (has1 && has3) {
                            if (!st0.empty()) { v = st0.back(); st0.pop_back(); c = 1; }
                            else if (!st1.empty()) { v = st1.back(); st1.pop_back(); c = 3; }
                        } else if (has2 && has3) {
                            if (!st1.empty()) { v = st1.back(); st1.pop_back(); c = 2; }
                            else if (!st0.empty()) { v = st0.back(); st0.pop_back(); c = 3; }
                        }

                        if (v == -1) {

                            if (uncolored.empty()) {
                                send_minus_one_and_flush();
                                finish(_pe, "No uncolored vertices left (internal).");
                            }
                            v = *uncolored.begin();
                            c = a;
                        }
                    } else {

                        int chosenV = -1, chosenC = -1;

                        auto tryPick = [&](int vtry) -> bool {
                            if (colored[vtry]) return false;
                            bool okA = !causesImmediateMono(tc.adj, color, vtry, a);
                            bool okB = !causesImmediateMono(tc.adj, color, vtry, b);
                            if (okA || okB) {
                                chosenV = vtry;
                                chosenC = okA ? a : b;
                                return true;
                            }
                            return false;
                        };

                        int scanned = 0;
                        for (int vtry : uncolored) {
                            if (tryPick(vtry)) break;
                            if (++scanned >= 64) break;
                        }
                        if (chosenV == -1) {

                            for (int vtry : uncolored) {
                                if (tryPick(vtry)) break;
                            }
                        }
                        if (chosenV == -1) {

                            if (uncolored.empty()) {
                                send_minus_one_and_flush();
                                finish(_pe, "No uncolored vertices left (internal).");
                            }
                            chosenV = *uncolored.begin();
                            chosenC = a;
                        }
                        v = chosenV;
                        c = chosenC;
                    }

                    if (v < 1 || v > tc.n || colored[v]) {
                        send_minus_one_and_flush();
                        finish(_pe, "Interactor selected invalid vertex (internal).");
                    }
                    if (!(c == a || c == b)) {
                        send_minus_one_and_flush();
                        finish(_pe, "Interactor selected invalid color (internal).");
                    }

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

                    applyColor(v, c);
                    uncolored.erase(v);

                    queries++;
                    if (queries > hard_cap) {
                        send_minus_one_and_flush();
                        finish(_pe, "Hard cap exceeded.");
                    }
                }

                bool contestantWon = aliceWins;
                if (!contestantWon) {
                    send_minus_one_and_flush();
                    finish(_wa, "Contestant chose Alice and lost.");
                }
            } else {

                vector<char> used(tc.n + 1, 0);

                for (int round = 1; round <= tc.n; round++) {
                    int a = 1, b = 2;
                    if (!tc.bip) {

                        a = 1; b = 2;
                    } else {

                        if (round & 1) { a = 1; b = 3; }
                        else { a = 2; b = 3; }
                    }

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

                    long long vLL, cLL;
                    if (!readIntManual(vLL) || !readIntManual(cLL)) {
                        finish(_pe, "Unexpected EOF while reading Bob move.");
                    }
                    int v = (int)vLL, c = (int)cLL;

                    if (v < 1 || v > tc.n || used[v]) {
                        send_minus_one_and_flush();
                        finish(_pe, "Invalid vertex in Bob move.");
                    }
                    if (!(c == a || c == b)) {
                        send_minus_one_and_flush();
                        finish(_pe, "Invalid color in Bob move.");
                    }

                    used[v] = 1;
                    applyColor(v, c);

                    queries++;
                    if (queries > hard_cap) {
                        send_minus_one_and_flush();
                        finish(_pe, "Hard cap exceeded.");
                    }
                }

                bool contestantWon = !aliceWins;
                if (!contestantWon) {
                    send_minus_one_and_flush();
                    finish(_wa, "Contestant chose Bob and lost.");
                }
            }

            if (coloredCnt != tc.n) {
                send_minus_one_and_flush();
                finish(_pe, "Not all vertices were colored (internal).");
            }
        }

        finish(_ok, "OK");
    } catch (const exception& e) {
        finish(_pe, string("Exception: ") + e.what());
    } catch (...) {
        finish(_pe, "Unknown exception.");
    }
}

#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 isAllSpace(const string& s) {
    for (unsigned char ch : s) if (!isspace(ch)) return false;
    return true;
}

static vector<long long> parseIntsFromLine(const string& line) {
    vector<long long> out;
    long long x;
    std::stringstream ss(line);
    while (ss >> x) out.push_back(x);
    return out;
}

static long long edgeKey(int u, int v) {
    if (u > v) swap(u, v);
    return (static_cast<long long>(u) << 20) ^ static_cast<long long>(v);
}

struct TestCase {
    int n = 0, m = 0;
    vector<pair<int,int>> edges;
    vector<vector<int>> adj;
    bool bip = true;
    vector<int> part[2];
};

static void addEdgeChecked(int n, unordered_set<long long>& used, vector<pair<int,int>>& edges, int u, int v) {
    if (u == v) return;
    if (u < 1 || u > n || v < 1 || v > n) return;
    long long k = edgeKey(u, v);
    if (used.find(k) != used.end()) return;
    used.insert(k);
    edges.push_back({u, v});
}

static TestCase buildGraphFromParams(int n, int m, int bipFlag) {
    TestCase tc;
    tc.n = n;
    int mMax = min(10000, n * (n - 1) / 2);
    m = max(0, min(mMax, m));
    if (n == 1) m = 0;
    else m = max(m, n - 1);
    bool wantBip = (bipFlag == 1);

    vector<pair<int,int>> edges;
    unordered_set<long long> used;
    used.reserve((size_t)m * 2 + 100);
    edges.reserve((size_t)m);

    if (n >= 2) {
        for (int i = 2; i <= n && (int)edges.size() < m; i++) addEdgeChecked(n, used, edges, i - 1, i);
    }

    if (!wantBip) {
        if (n >= 3) {
            if (m < n) m = n;
            if ((int)edges.size() < m) addEdgeChecked(n, used, edges, 1, 3);
        } else {
            wantBip = true;
        }
    }

    auto wantCross = [&](int u, int v) -> bool {
        return ((u ^ v) & 1) == 1;
    };

    int u = 1, v = 2;
    while ((int)edges.size() < m) {
        if (n <= 1) break;
        if (u > n) break;
        if (v > n) {
            u++;
            v = u + 1;
            continue;
        }
        bool ok = true;
        if (wantBip) {
            if (!wantCross(u, v)) ok = false;
        }
        if (ok) addEdgeChecked(n, used, edges, u, v);
        v++;
    }

    if ((int)edges.size() < m && wantBip && n >= 2) {
        vector<int> odd, even;
        for (int i = 1; i <= n; i++) ((i & 1) ? odd : even).push_back(i);
        for (int a : odd) {
            for (int b : even) {
                if ((int)edges.size() >= m) break;
                addEdgeChecked(n, used, edges, a, b);
            }
            if ((int)edges.size() >= m) break;
        }
    }

    if ((int)edges.size() < m) {
        for (int a = 1; a <= n && (int)edges.size() < m; a++) {
            for (int b = a + 1; b <= n && (int)edges.size() < m; b++) {
                addEdgeChecked(n, used, edges, a, b);
            }
        }
    }

    if ((int)edges.size() > m) edges.resize(m);
    tc.m = (int)edges.size();
    tc.edges = std::move(edges);
    return tc;
}

static void buildAdjAndBip(TestCase& tc) {
    tc.adj.assign(tc.n + 1, {});
    tc.adj.shrink_to_fit();
    tc.adj.assign(tc.n + 1, {});
    for (auto [u, v] : tc.edges) {
        tc.adj[u].push_back(v);
        tc.adj[v].push_back(u);
    }

    vector<int> side(tc.n + 1, -1);
    queue<int> q;
    tc.bip = true;
    for (int i = 1; i <= tc.n; i++) {
        if (side[i] != -1) continue;
        side[i] = 0;
        q.push(i);
        while (!q.empty()) {
            int x = q.front(); q.pop();
            for (int y : tc.adj[x]) {
                if (side[y] == -1) {
                    side[y] = side[x] ^ 1;
                    q.push(y);
                } else if (side[y] == side[x]) {
                    tc.bip = false;
                }
            }
        }
    }
    tc.part[0].clear();
    tc.part[1].clear();
    tc.part[0].reserve(tc.n);
    tc.part[1].reserve(tc.n);
    for (int i = 1; i <= tc.n; i++) {
        int s = side[i];
        if (s < 0) s = 0;
        tc.part[s].push_back(i);
    }
    sort(tc.part[0].begin(), tc.part[0].end());
    sort(tc.part[1].begin(), tc.part[1].end());
}

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

static bool readIntSafe(int& x) {
    long long v;
    if (!(cin >> v)) return false;
    if (v < INT_MIN || v > INT_MAX) return false;
    x = (int)v;
    return true;
}

static void sendMinusOne() {
    cout << -1 << "\n";
    cout.flush();
}

struct BipBobPicker {
    const vector<int>* part0 = nullptr;
    const vector<int>* part1 = nullptr;
    vector<int>* color = nullptr;
    int p0 = 0, p1 = 0;

    int takeFrom(const vector<int>& part, int& ptr) {
        while (ptr < (int)part.size() && (*color)[part[ptr]] != 0) ptr++;
        if (ptr >= (int)part.size()) return -1;
        int v = part[ptr];
        ptr++;
        return v;
    }

    int hasFrom(const vector<int>& part, int ptr) {
        while (ptr < (int)part.size() && (*color)[part[ptr]] != 0) ptr++;
        return ptr < (int)part.size();
    }

    pair<int,int> pick(int a, int b) {
        int x = min(a, b), y = max(a, b);

        if (x == 1 && y == 2) {
            if (hasFrom(*part0, p0)) return {takeFrom(*part0, p0), 1};
            return {takeFrom(*part1, p1), 2};
        }
        if (x == 1 && y == 3) {
            if (hasFrom(*part0, p0)) return {takeFrom(*part0, p0), 1};
            return {takeFrom(*part1, p1), 3};
        }

        if (hasFrom(*part1, p1)) return {takeFrom(*part1, p1), 2};
        return {takeFrom(*part0, p0), 3};
    }
};

static bool isSafeColor(const TestCase& tc, const vector<int>& color, int v, int c) {
    for (int nei : tc.adj[v]) {
        if (color[nei] == c) return false;
    }
    return true;
}

static pair<int,int> pickGreedyBobMove(const TestCase& tc, const vector<int>& color, int a, int b, bool alreadyMono) {
    int n = tc.n;
    if (alreadyMono) {
        for (int v = 1; v <= n; v++) {
            if (color[v] == 0) return {v, a};
        }
        return {-1, a};
    }

    int bestV = -1;
    int bestC = -1;
    int bestSafeCount = 3;

    for (int v = 1; v <= n; v++) {
        if (color[v] != 0) continue;
        bool safeA = isSafeColor(tc, color, v, a);
        bool safeB = isSafeColor(tc, color, v, b);
        int sc = (int)safeA + (int)safeB;
        if (sc == 0) continue;
        if (sc < bestSafeCount || (sc == bestSafeCount && v < bestV)) {
            bestSafeCount = sc;
            bestV = v;
            if (sc == 1) bestC = safeA ? a : b;
            else bestC = min(a, b);
        }
    }

    if (bestV != -1) return {bestV, bestC};

    for (int v = 1; v <= n; v++) {
        if (color[v] == 0) return {v, min(a, b)};
    }
    return {-1, min(a, b)};
}

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

    string line;
    int t = 0;

    while (!inf.eof()) {
        line = inf.readLine();
        if (!isAllSpace(line)) break;
    }
    if (isAllSpace(line)) finish(_pe, "empty input");
    {
        auto v = parseIntsFromLine(line);
        if (v.size() != 1) finish(_pe, "bad t line");
        if (v[0] < 1 || v[0] > 1000) finish(_pe, "t out of range");
        t = (int)v[0];
    }

    vector<TestCase> cases;
    cases.reserve(t);

    for (int tcId = 0; tcId < t; tcId++) {
        string header;
        while (true) {
            if (inf.eof()) finish(_pe, "unexpected EOF in test header");
            header = inf.readLine();
            if (!isAllSpace(header)) break;
        }
        auto hv = parseIntsFromLine(header);
        if (!(hv.size() == 2 || hv.size() == 3)) finish(_pe, "bad test header arity");
        long long nll = hv[0], mll = hv[1];
        if (nll < 1 || nll > 10000) finish(_pe, "n out of range");
        int n = (int)nll;
        int mMax = min(10000, n * (n - 1) / 2);
        if (mll < 0 || mll > 10000) finish(_pe, "m out of range");
        int m = (int)mll;
        TestCase tc;
        if (hv.size() == 3) {
            int bipFlag = (int)hv[2];
            if (!(bipFlag == 0 || bipFlag == 1)) finish(_pe, "bipFlag out of range");
            tc = buildGraphFromParams(n, m, bipFlag);
        } else {
            tc.n = n;
            tc.m = m;
            tc.edges.clear();
            tc.edges.reserve((size_t)m);
            for (int i = 0; i < m; i++) {
                if (inf.eof()) finish(_pe, "unexpected EOF in edges");
                string eline = inf.readLine();
                if (isAllSpace(eline)) { i--; continue; }
                auto ev = parseIntsFromLine(eline);
                if (ev.size() != 2) finish(_pe, "bad edge line");
                int u = (int)ev[0], v = (int)ev[1];
                if (u < 1 || u > n || v < 1 || v > n || u == v) finish(_pe, "edge endpoint out of range");
                tc.edges.push_back({u, v});
            }
        }
        buildAdjAndBip(tc);
        cases.push_back(std::move(tc));
    }

    query_limit = 0;
    for (auto& tc : cases) query_limit += tc.n;
    if (query_limit < 0) query_limit = 0;
    log_metrics();

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

    cout << t << "\n";
    for (int tcId = 0; tcId < t; tcId++) {
        const auto& tc = cases[tcId];
        cout << tc.n << " " << (int)tc.edges.size() << "\n";
        for (auto [u, v] : tc.edges) cout << u << " " << v << "\n";
    }
    cout.flush();

    for (int tcId = 0; tcId < t; tcId++) {
        const TestCase& tc = cases[tcId];
        vector<int> color(tc.n + 1, 0);
        vector<char> used(tc.n + 1, 0);
        bool hasMono = false;

        string role;
        if (!readToken(role)) finish(_pe, "EOF while reading role");
        if (role != "Alice" && role != "Bob") {
            sendMinusOne();
            finish(_pe, "invalid role token");
        }

        bool contestantAlice = (role == "Alice");

        BipBobPicker bipBob;
        if (tc.bip) {
            bipBob.part0 = &tc.part[0];
            bipBob.part1 = &tc.part[1];
            bipBob.color = &color;
        }

        auto applyColorAndCheck = [&](int v, int c) {
            color[v] = c;
            used[v] = 1;
            for (int nei : tc.adj[v]) {
                if (color[nei] == c) hasMono = true;
            }
        };

        if (!contestantAlice) {

            for (int round = 1; round <= tc.n; round++) {
                if (++queries > hard_cap) {
                    sendMinusOne();
                    finish(_pe, "too many queries (hard cap)");
                }

                int a = 1, b = 2;
                if (!tc.bip) {
                    a = 1; b = 2;
                } else {
                    int r = (round - 1) % 3;
                    if (r == 0) { a = 1; b = 2; }
                    else if (r == 1) { a = 1; b = 3; }
                    else { a = 2; b = 3; }
                }

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

                int i, c;
                if (!readIntSafe(i) || !readIntSafe(c)) {
                    finish(_pe, "EOF/malformed Bob move");
                }
                if (i < 1 || i > tc.n || used[i]) {
                    sendMinusOne();
                    finish(_pe, "invalid vertex index");
                }
                if (!(c == a || c == b)) {
                    sendMinusOne();
                    finish(_pe, "invalid color choice");
                }

                applyColorAndCheck(i, c);

                if (hasMono) {
                    sendMinusOne();
                    finish(_wa, "Bob created monochromatic edge");
                }
            }

            continue;
        } else {

            for (int round = 1; round <= tc.n; round++) {
                if (++queries > hard_cap) {
                    sendMinusOne();
                    finish(_pe, "too many queries (hard cap)");
                }

                int a, b;
                if (!readIntSafe(a) || !readIntSafe(b)) finish(_pe, "EOF/malformed Alice move");
                if (a < 1 || a > 3 || b < 1 || b > 3 || a == b) {
                    sendMinusOne();
                    finish(_pe, "invalid Alice colors");
                }

                pair<int,int> move = {-1, a};
                if (hasMono) {
                    move = pickGreedyBobMove(tc, color, a, b, true);
                } else if (tc.bip) {
                    move = bipBob.pick(a, b);
                } else {
                    move = pickGreedyBobMove(tc, color, a, b, false);
                }

                int v = move.first, c = move.second;
                if (v < 1 || v > tc.n || used[v]) {

                    v = -1;
                    for (int x = 1; x <= tc.n; x++) if (!used[x]) { v = x; break; }
                    if (v == -1) {
                        sendMinusOne();
                        finish(_pe, "no available vertex to color");
                    }
                    c = a;
                }
                if (!(c == a || c == b)) c = a;

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

                applyColorAndCheck(v, c);
            }

            if (!hasMono) {

                sendMinusOne();
                finish(_wa, "Alice did not create monochromatic edge");
            }
        }
    }

    finish(_ok, "ok");
}

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

static long long edgeKey(int u, int v) {
    if (u > v) swap(u, v);
    return (static_cast<long long>(u) << 20) ^ static_cast<long long>(v);
}

struct GraphGen {
    int n = 0, m = 0;
    bool bip = true;

    unordered_set<long long> used;
    vector<pair<int,int>> edges;

    bool addEdge(int u, int v) {
        if (u == v) return false;
        if (u < 1 || u > n || v < 1 || v > n) return false;
        long long k = edgeKey(u, v);
        if (used.find(k) != used.end()) return false;
        used.insert(k);
        edges.push_back({u, v});
        return true;
    }

    int pickFromPart(const vector<int>& part, bool biased) {
        int sz = (int)part.size();
        if (sz == 0) return -1;
        if (!biased) return part[rnd.next(0, sz - 1)];
        int cap = min(sz, 64);
        int roll = rnd.next(1, 100);
        if (roll <= 85) return part[rnd.next(0, cap - 1)];
        return part[rnd.next(0, sz - 1)];
    }

    void build(bool wantBip) {
        bip = wantBip;
        used.reserve((size_t)m * 2 + 100);
        edges.reserve((size_t)m);

        if (n == 1) {
            m = 0;
            return;
        }

        for (int i = 2; i <= n && (int)edges.size() < m; i++) {
            addEdge(i - 1, i);
        }

        if (!bip) {
            if (n < 3) {
                bip = true;
            } else {
                if (m < n) m = n;

                if ((int)edges.size() < m) addEdge(1, 3);
            }
        }

        vector<int> part0, part1;
        part0.reserve((n + 1) / 2);
        part1.reserve((n + 1) / 2);
        for (int i = 1; i <= n; i++) {
            if (i & 1) part1.push_back(i);
            else part0.push_back(i);
        }

        auto wantCrossEdge = [&](void) -> bool {
            if (bip) return true;
            return rnd.next(1, 100) <= 90;
        };

        int attempts = 0;
        int maxAttempts = 2000000;
        while ((int)edges.size() < m && attempts < maxAttempts) {
            attempts++;

            bool cross = wantCrossEdge();
            if (cross) {
                bool biased = (rnd.next(1, 100) <= 80);
                bool uIn0 = (rnd.next(0, 1) == 0);
                int u = pickFromPart(uIn0 ? part0 : part1, biased);
                int v = pickFromPart(uIn0 ? part1 : part0, false);
                if (u == -1 || v == -1) continue;
                addEdge(u, v);
            } else {

                bool in0 = (rnd.next(0, 1) == 0);
                const vector<int>& part = in0 ? part0 : part1;
                if ((int)part.size() < 2) continue;
                int u = pickFromPart(part, true);
                int v = pickFromPart(part, true);
                if (u == -1 || v == -1 || u == v) continue;
                addEdge(u, v);
            }
        }

        if ((int)edges.size() < m) {
            for (int u = 1; u <= n && (int)edges.size() < m; u++) {
                for (int v = u + 1; v <= n && (int)edges.size() < m; v++) {
                    if (bip) {
                        if ( ((u ^ v) & 1) == 0 ) continue;
                    }
                    addEdge(u, v);
                }
            }
        }

        if ((int)edges.size() > m) edges.resize(m);
    }
};

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

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

    int nOpt = opt<int>("n", 0);
    int mOpt = opt<int>("m", 0);
    int bipOpt = opt<int>("bip", -1);

    auto decideDefaults = [&](int& n, int& m, bool& bip) {
        if (baseSeed == 1) {
            n = 1; m = 0; bip = true;
            return;
        }
        if (baseSeed == 2) {
            n = 2; m = 1; bip = true;
            return;
        }
        if (baseSeed == 3) {
            n = 3; m = 3; bip = false;
            return;
        }

        n = (nOpt > 0 ? nOpt : 10000);
        n = max(1, min(10000, n));

        int mMax = min(10000, n * (n - 1) / 2);
        if (mOpt > 0) m = mOpt;
        else m = mMax;

        m = max(0, min(mMax, m));
        if (n == 1) m = 0;
        else m = max(m, n - 1);

        if (bipOpt == 0) bip = false;
        else if (bipOpt == 1) bip = true;
        else bip = (baseSeed % 2 == 0);
    };

    if (mode != "non" && mode != "adp") {
        mode = "non";
    }

    if (mode == "non") {
        int n, m;
        bool bip;
        decideDefaults(n, m, bip);

        GraphGen gg;
        gg.n = n;
        gg.m = m;

        if (!bip) {
            if (n < 3) bip = true;
            else if (m < n) m = n;
        }

        gg.m = m;
        gg.build(bip);

        cout << 1 << "\n";
        cout << gg.n << " " << gg.m << "\n";
        for (auto &e : gg.edges) {
            cout << e.first << " " << e.second << "\n";
        }
        return 0;
    }

    {
        int n, m;
        bool bip;
        decideDefaults(n, m, bip);

        if (!bip) {
            if (n < 3) bip = true;
            else if (m < n) m = n;
        }
        int mMax = min(10000, n * (n - 1) / 2);
        m = max(0, min(mMax, m));
        if (n == 1) m = 0;
        else m = max(m, n - 1);
        if (!bip && n >= 3) m = max(m, n);

        cout << 1 << "\n";
        cout << n << " " << m << " " << (bip ? 1 : 0) << "\n";
    }

    return 0;
}


This is an interactive problem.

Consider the following game for two players:

* Initially, an array of integers $a_1, a_2, \ldots, a_n$ of length $n$ is written on blackboard.
* Game consists of rounds. On each round, the following happens:
  + The first player selects any $i$ such that $a_i \gt 0$. If there is no such $i$, the first player loses the game (the second player wins) and game ends.
  + The second player selects any $j \neq i$ such that $a_j \gt 0$. If there is no such $j$, the second player loses the game (the first player wins) and game ends.
  + Let $d = \min(a_i, a_j)$. The values of $a_i$ and $a_j$ are simultaneously decreased by $d$ and the next round starts.

It can be shown that game always ends after the finite number of rounds.

You have to select which player you will play for (first or second) and win the game.

Input

The first line contains a single integer $n$ ($1 \le n \le 300$) — the length of array $a$.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 300$) — array $a$.

Interaction

Interaction begins after reading $n$ and array $a$.

You should start interaction by printing a single line, containing either "First" or "Second", representing the player you select.

On each round, the following happens:

* If you are playing as the first player, you should print a single integer $i$ ($1 \le i \le n$) on a separate line. After that, you should read a single integer $j$ ($-1 \le j \le n$) written on a separate line.

  If $j = -1$, then you made an incorrect move. In this case your program should terminate immediately.

  If $j = 0$, then the second player can't make a correct move and you win the game. In this case your program should also terminate immediately.

  Otherwise $j$ is equal to the index chosen by the second player, and you should proceed to the next round.
* If you are playing as the second player, you should read a single integer $i$ ($-1 \le i \le n$) written on a separate line.

  If $i = -1$, then you made an incorrect move on the previous round (this cannot happen on the first round). In that case your program should terminate immediately.

  If $i = 0$, then the first player can't make a correct move and you win the game. In this case your program should also terminate immediately.

  Otherwise $i$ is equal to the index chosen by first player. In this case you should write single integer $j$ ($1 \le j \le n$) on a separate line and proceed to the next round.

After printing $i$ or $j$, 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

```
4
10 4 6 3

3

1

0
```

Output

```
First
1

2

4
```

Input

```
6
4 5 5 11 3 2

2

5

4

6

1

0
```

Output

```
Second

4

4

3

1

3
```

Note

In the first example $n = 4$ and array $a$ is $[\, 10, 4, 6, 3 \,]$. The game goes as follows:

* After reading array $a$ contestant's program chooses to play as the first player and prints "First".
* First round: the first player chooses $i = 1$, the second player chooses $j = 3$. $d = \min(a_1, a_3) = \min(10, 6) = 6$ is calculated. Elements $a_1$ and $a_3$ are decreased by $6$. Array $a$ becomes equal to $[\, 4, 4, 0, 3 \,]$.
* Second round: the first player chooses $i = 2$, the second player chooses $j = 1$. $d = \min(a_2, a_1) = \min(4, 4) = 4$ is calculated. Elements $a_2$ and $a_1$ are decreased by $4$. Array $a$ becomes equal to $[\, 0, 0, 0, 3 \,]$.
* Third round: the first player chooses $i = 4$. There is no $j \neq 4$ such that $a_j > 0$, so the second player can't make a correct move and the first player wins. Jury's program prints $j = 0$. After reading it, contestant's program terminates.

In the second example $n = 6$ and array $a$ is $[\, 4, 5, 5, 11, 3, 2 \,]$. The game goes as follows:

* Contestant's program chooses to play as the second player and prints "Second".
* First round: $i = 2$, $j = 4$, $a = [\, 4, 0, 5, 6, 3, 2 \,]$.
* Second round: $i = 5$, $j = 4$, $a = [\, 4, 0, 5, 3, 0, 2 \,]$.
* Third round: $i = 4$, $j = 3$, $a = [\, 4, 0, 2, 0, 0, 2 \,]$.
* Fourth round: $i = 6$, $j = 1$, $a = [\, 2, 0, 2, 0, 0, 0 \,]$.
* Fifth round: $i = 1$, $j = 3$, $a = [\, 0, 0, 0, 0, 0, 0 \,]$.
* Sixth round: the first player can't make a correct move and the second player wins. Jury's program prints $i = 0$. After reading it, contestant's program terminates.

Note that the example interaction contains extra empty lines so that it's easier to read. The real interaction doesn't contain any empty lines and you shouldn't print any extra empty lines as well.

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

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

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());
}

static void die_wa(const string& msg) {
    cout << -1 << endl;
    finish(_wa, msg);
}

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

    int n = inf.readInt(1, 300, "n");
    vector<int> a(n);
    long long sum = 0;
    for(int i = 0; i < n; i++) {
        a[i] = inf.readInt(1, 300, "a_i");
        sum += a[i];
    }

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

    bool is_partitionable = false;
    vector<int> group(n, 0);

    if (sum % 2 == 0) {
        int target = (int)(sum / 2);

        vector<bitset<90005>> history(n + 1);
        history[0][0] = 1;

        for(int i = 0; i < n; i++) {
            history[i+1] = history[i] | (history[i] << a[i]);
        }

        if (history[n][target]) {
            is_partitionable = true;
            group.assign(n, 2);
            int curr = target;

            for(int i = n - 1; i >= 0; i--) {

                if (curr >= a[i] && history[i][curr - a[i]]) {
                    group[i] = 1;
                    curr -= a[i];
                }
            }
        }
    }

    string token;
    if (!(cin >> token)) finish(_wa, "No output for role choice");

    string choice = "";
    for (char c : token) choice += tolower(c);

    bool human_first = false;
    if (choice == "first") human_first = true;
    else if (choice == "second") human_first = false;
    else die_wa("Expected 'First' or 'Second', got: " + token);

    while (queries < query_limit) {
        queries++;
        if (queries % 10 == 0) log_metrics();

        int i_idx = -1;
        int j_idx = -1;

        if (human_first) {

            string t;
            if (!(cin >> t)) finish(_wa, "Unexpected end of stream waiting for move");
            if (t == "?") cin >> t;

            try {
                i_idx = stoi(t);
            } catch (...) { die_wa("Invalid integer format: " + t); }

            if (i_idx < 1 || i_idx > n) die_wa("Index out of bounds: " + t);
            if (a[i_idx-1] == 0) die_wa("Selected index with value 0");

            vector<int> candidates;
            if (is_partitionable) {
                int g = group[i_idx-1];
                int target = 3 - g;
                for(int k=0; k<n; ++k) {
                    if (group[k] == target && a[k] > 0) {
                        candidates.push_back(k+1);
                    }
                }
            } else {

                for(int k=0; k<n; ++k) {
                    if (k+1 != i_idx && a[k] > 0) {
                        candidates.push_back(k+1);
                    }
                }
            }

            int best_j = -1, max_v = -1;
            for(int c : candidates) {
                if (a[c-1] > max_v) {
                    max_v = a[c-1];
                    best_j = c;
                }
            }
            j_idx = best_j;

            if (j_idx == -1) {

                cout << 0 << endl;
                finish(_ok, "Contestant won (Second had no moves)");
            }

            cout << j_idx << endl;

        } else {

            int best_i = -1, max_v = -1;
            for(int k=0; k<n; ++k) {
                if (a[k] > 0 && a[k] > max_v) {
                    max_v = a[k];
                    best_i = k+1;
                }
            }
            i_idx = best_i;

            if (i_idx == -1) {

                cout << 0 << endl;
                finish(_ok, "Contestant won (First had no moves)");
            }

            cout << i_idx << endl;

            string t;
            if (!(cin >> t)) finish(_wa, "Unexpected end of stream waiting for response");
            if (t == "?") cin >> t;

            try {
                j_idx = stoi(t);
            } catch (...) { die_wa("Invalid integer format: " + t); }

            if (j_idx == 0) {

                finish(_wa, "Contestant lost (printed 0)");
            }

            if (j_idx < 1 || j_idx > n) die_wa("Index out of bounds");
            if (j_idx == i_idx) die_wa("Same index chosen as First player");
            if (a[j_idx-1] == 0) die_wa("Selected index with value 0");
        }

        int d = min(a[i_idx-1], a[j_idx-1]);
        a[i_idx-1] -= d;
        a[j_idx-1] -= d;
    }

    finish(_pe, "Query limit exceeded");
}

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

using namespace std;

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

void log_metrics() {

    long long limit = (query_limit == 0 ? 1 : query_limit);
    tout << "queries=" << queries << endl;
    tout << "query_limit=" << limit << endl;
}

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

vector<int> get_partition(int n, const vector<int>& a) {
    long long sum = 0;
    for (int x : a) sum += x;
    if (sum % 2 != 0) return {};

    int target = (int)(sum / 2);

    vector<bitset<90005>> dp(n + 1);
    dp[0][0] = 1;

    for (int i = 0; i < n; ++i) {
        dp[i + 1] = dp[i] | (dp[i] << a[i]);
    }

    if (!dp[n][target]) return {};

    vector<int> side(n + 1, 0);
    int curr = target;
    for (int i = n - 1; i >= 0; --i) {

        if (dp[i][curr]) {
            side[i + 1] = 2;
        } else {
            side[i + 1] = 1;
            curr -= a[i];
        }
    }
    return side;
}

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

    int n = inf.readInt(1, 300, "n");
    vector<int> a(n);
    long long sum_a = 0;
    for (int i = 0; i < n; ++i) {
        a[i] = inf.readInt(1, 300, "a_i");
        sum_a += a[i];
    }

    query_limit = sum_a + 200;
    log_metrics();

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

    vector<int> sides = get_partition(n, a);
    bool is_partitionable = !sides.empty();
    if (sides.empty()) {
        sides.assign(n + 1, 1);
    }

    string choice;
    if (!(cin >> choice)) {
        finish(_wa, "Failed to read choice (First/Second)");
    }

    bool i_am_first = false;
    if (choice == "First") {
        i_am_first = false;
    } else if (choice == "Second") {
        i_am_first = true;
    } else {
        finish(_wa, "Invalid choice token: " + choice);
    }

    while (true) {
        queries++;
        if (queries % 10 == 0) log_metrics();

        if (queries > query_limit + 500) {
            finish(_pe, "Game did not terminate within reasonable limits");
        }

        int i_idx = -1;
        int j_idx = -1;

        if (i_am_first) {

            vector<int> candidates;
            for (int k = 1; k <= n; ++k) {
                if (a[k - 1] > 0) candidates.push_back(k);
            }

            if (candidates.empty()) {

                cout << 0 << endl;
                finish(_ok, "Interactor (First) exhausted moves. Contestant wins.");
            }

            int best_k = candidates[0];
            for (int k : candidates) {
                if (a[k - 1] > a[best_k - 1]) best_k = k;
            }
            i_idx = best_k;
            cout << i_idx << endl;

            if (!(cin >> j_idx)) {
                finish(_wa, "Failed to read j from contestant");
            }

            if (j_idx == 0) {
                finish(_wa, "Contestant (Second) cannot move. Interactor wins.");
            }
            if (j_idx == -1) {
                finish(_wa, "Contestant output -1 (invalid move signal)");
            }

            if (j_idx < 1 || j_idx > n) finish(_wa, "j out of bounds");
            if (j_idx == i_idx) finish(_wa, "j == i is not allowed");
            if (a[j_idx - 1] == 0) finish(_wa, "a[j] is 0 (invalid move)");

        } else {

            if (!(cin >> i_idx)) {
                finish(_wa, "Failed to read i from contestant");
            }

            if (i_idx == 0) {
                finish(_wa, "Contestant (First) cannot move. Interactor wins.");
            }
            if (i_idx == -1) {
                finish(_wa, "Contestant output -1");
            }
            if (i_idx < 1 || i_idx > n) finish(_wa, "i out of bounds");
            if (a[i_idx - 1] == 0) finish(_wa, "a[i] is 0 (invalid move)");

            int target_side = (sides[i_idx] == 1 ? 2 : 1);
            vector<int> candidates;

            if (is_partitionable) {
                for (int k = 1; k <= n; ++k) {
                    if (k != i_idx && a[k - 1] > 0 && sides[k] == target_side) {
                        candidates.push_back(k);
                    }
                }
            }

            if (candidates.empty()) {
                for (int k = 1; k <= n; ++k) {
                    if (k != i_idx && a[k - 1] > 0) {
                        candidates.push_back(k);
                    }
                }
            }

            if (candidates.empty()) {

                cout << 0 << endl;
                finish(_ok, "Interactor (Second) exhausted moves. Contestant wins.");
            }

            int best_j = candidates[0];
            for (int k : candidates) {
                if (a[k - 1] > a[best_j - 1]) best_j = k;
            }
            j_idx = best_j;
            cout << j_idx << endl;
        }

        int val = min(a[i_idx - 1], a[j_idx - 1]);
        a[i_idx - 1] -= val;
        a[j_idx - 1] -= val;

    }

    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 = atoi(argv[1]);

    int n;
    vector<int> a;

    if (seed_val == 1) {

        n = 1;
        a = {1};
    } else if (seed_val == 2) {

        n = 2;
        a = {10, 10};
    } else if (seed_val == 3) {

        n = 2;
        a = {10, 20};
    } else if (seed_val == 4) {

        n = 300;
        a.assign(n, 300);
    } else if (seed_val == 5) {

        n = 50;
        a.assign(n, 300);
        a[0] = 299;
    } else {

        n = rnd.next(1, 300);

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

        if (type == 1) {

            if (n == 1) n = 2;

            a.clear();
            if (n % 2 == 0) {
                int pairs = n / 2;
                for (int i = 0; i < pairs; i++) {
                    int x = rnd.next(1, 300);
                    a.push_back(x);
                    a.push_back(x);
                }
            } else {
                int pairs = (n - 3) / 2;
                for (int i = 0; i < pairs; i++) {
                    int x = rnd.next(1, 300);
                    a.push_back(x);
                    a.push_back(x);
                }
                int x = rnd.next(1, 150);
                a.push_back(x);
                a.push_back(x);
                a.push_back(2 * x);
            }
        } else {

            a.resize(n);
            long long sum = 0;
            for (int i = 0; i < n; i++) {
                a[i] = rnd.next(1, 300);
                sum += a[i];
            }

            if (type == 2) {

                if (sum % 2 == 0) {
                    int idx = rnd.next(n);
                    if (a[idx] < 300) a[idx]++;
                    else a[idx]--;
                }
            }
        }
    }

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

    cout << n << endl;
    println(a);

    return 0;
}


The only difference between easy and hard versions is the maximum number of queries. In this version, you are allowed to ask at most $1000$ queries.

This is an interactive problem.

You are playing a game. The circle is divided into $n$ sectors, sectors are numbered from $1$ to $n$ in some order. You are in the adjacent room and do not know either the number of sectors or their numbers. There is also an arrow that initially points to some sector. Initially, the host tells you the number of the sector to which the arrow points. After that, you can ask the host to move the arrow $k$ sectors counterclockwise or clockwise at most $1000$ times. And each time you are told the number of the sector to which the arrow points.

Your task is to determine the integer $n$ — the number of sectors in at most $1000$ queries.

It is guaranteed that $1 \le n \le 10^6$.

Input

The input consists of a single integer $x$ ($1 \le x \le n$) — the number of the initial sector.

Output

After you determine the integer $n$ — the number of sectors, you should output "! n" ($1 \le n \le 10^6$). After that the program should immediately terminate.

Note that, printing the answer does not count as a query.

It is guaranteed that the integer $n$ and the numbers of the sectors are fixed initially and will not be changed by the jury program depending on the queries.

Interaction

After reading the description of the input, you may ask queries. Queries can be of two types:

1. "+ k" ($0 \le k \le 10^9$) — ask to move the arrow $k$ sectors clockwise.
2. "- k" ($0 \le k \le 10^9$) — ask to move the arrow $k$ sectors counterclockwise.

After each query, you should read an integer $x$ ($1 \le x \le n$) — the number of the current sector to which the arrow points.

You are allowed to make at most $1000$ queries in total.

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

After printing a query or the answer, do not forget to output a 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.

Example

Input

```
1

5

6

7

2

10

9

8

4

3

1
```

Output

```
+ 1

+ 1

+ 1

+ 1

+ 1

+ 1

+ 1

+ 1

+ 1

+ 1

! 10
```

Note

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

static long long queries = 0;
static long long query_limit = 1000;
static const long long HARD_CAP = 200000;

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());
}

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

    registerInteraction(argc, argv);

    atexit(log_metrics);

    int n = inf.readInt(1, 1000000, "n");
    vector<int> p(n);
    for (int i = 0; i < n; ++i) {
        p[i] = inf.readInt(1, n, format("p[%d]", i));
    }

    query_limit = 1000;

    int current_pos = 0;

    cout << p[current_pos] << endl;

    log_metrics();

    while (true) {

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

        string token;
        if (!(cin >> token)) {
            finish(_pe, "Unexpected EOF: expected query or answer");
        }

        if (token == "?") {
            if (!(cin >> token)) {
                finish(_pe, "Unexpected EOF after '?'");
            }
        }

        if (token == "!") {

            long long ans_n;
            if (!(cin >> ans_n)) {
                finish(_pe, "Expected number after '!'");
            }

            if (ans_n == n) {
                finish(_ok, format("Correct! n=%d, queries=%lld", n, queries));
            } else {
                finish(_wa, format("Wrong answer. Expected n=%d, found %lld", n, ans_n));
            }
        }
        else if (token == "+" || token == "-") {

            long long k;
            if (!(cin >> k)) {
                finish(_pe, "Expected integer k after operation");
            }

            if (k < 0 || k > 1000000000LL) {
                finish(_pe, format("k out of bounds: %lld", k));
            }

            if (token == "+") {

                current_pos = (int)((current_pos + k) % n);
            } else {

                long long step = k % n;
                current_pos = (int)((current_pos - step + n) % n);
            }

            queries++;

            cout << p[current_pos] << endl;

            if (queries % 10 == 0) {
                log_metrics();
            }
        }
        else {
            finish(_pe, format("Invalid token: '%s'", token.c_str()));
        }
    }

    return 0;
}

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

using namespace std;

static long long queries = 0;
static long long query_limit = 1000;
static const long long HARD_CAP = 20000;

static void log_metrics() {
    try {

        if (tout.is_open()) {
            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);

    log_metrics();

    int n = inf.readInt(1, 1000000, "n");

    vector<int> available_labels(n);
    iota(available_labels.begin(), available_labels.end(), 1);
    shuffle(available_labels.begin(), available_labels.end());

    vector<int> sector_labels(n, -1);

    long long current_index = 0;

    sector_labels[current_index] = available_labels.back();
    available_labels.pop_back();

    cout << sector_labels[current_index] << endl;

    while (true) {

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

        string type;
        if (!(cin >> type)) {
            finish(_pe, "Unexpected end of file from contestant");
        }

        if (type == "!") {

            long long ans;
            if (!(cin >> ans)) {
                finish(_pe, "Expected integer after '!'");
            }

            if (ans == n) {
                finish(_ok, "Correct");
            } else {
                finish(_wa, format("Wrong answer: expected %d, found %lld", n, ans));
            }
        } else if (type == "+" || type == "-") {

            long long k;
            if (!(cin >> k)) {
                finish(_pe, "Expected integer k after +/-");
            }

            if (k < 0 || k > 1000000000LL) {
                 finish(_pe, format("k is out of range: %lld", k));
            }

            queries++;

            if (type == "+") {
                current_index = (current_index + k) % n;
            } else {

                long long rem = (current_index - k) % n;
                if (rem < 0) rem += n;
                current_index = rem;
            }

            if (sector_labels[current_index] == -1) {
                sector_labels[current_index] = available_labels.back();
                available_labels.pop_back();
            }

            cout << sector_labels[current_index] << endl;

        } else {
            finish(_pe, "Unknown query type: " + type);
        }
    }

    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);

    if (n == -1) {

        string seed_str = argv[1];
        long long seed_val = 0;
        bool is_small_seed = true;

        for (char c : seed_str) {
            if (!isdigit(c)) {
                is_small_seed = false;
                break;
            }
            seed_val = seed_val * 10 + (c - '0');
            if (seed_val > 100) {
                is_small_seed = false;
                break;
            }
        }

        if (is_small_seed && seed_val >= 1 && seed_val <= 10) {

            switch (seed_val) {
                case 1: n = 1; break;
                case 2: n = 2; break;
                case 3: n = 1000000; break;
                case 4: n = 999999; break;
                case 5: n = 1000; break;
                case 6: n = 1001; break;
                case 7: n = 500000; break;
                case 8: n = 3; break;
                case 9: n = 10; break;
                case 10: n = rnd.next(1, 100); break;
            }
        } else {

            int t = rnd.next(100);
            if (t < 5) n = rnd.next(1, 100);
            else if (t < 15) n = rnd.next(101, 1000);
            else if (t < 30) n = rnd.next(1001, 100000);
            else if (t < 95) n = rnd.next(900000, 1000000);
            else n = rnd.next(1, 1000000);
        }
    }

    n = max(1, min(n, 1000000));

    cout << n << endl;

    if (mode == "non") {

        vector<int> p = rnd.perm(n, 1);
        println(p);
    } else if (mode == "adp") {

    }

    return 0;
}


This is an interactive problem.

You're given a tree consisting of $n$ nodes, rooted at node $1$. A tree is a connected graph with no cycles.

We chose a hidden node $x$. In order to find this node, you can ask queries of two types:

* d $u$ ($1 \le u \le n$). We will answer with the distance between nodes $u$ and $x$. The distance between two nodes is the number of edges in the shortest path between them.
* s $u$ ($1 \le u \le n$). We will answer with the second node on the path from $u$ to $x$. However, there's a plot twist. If $u$ is not an ancestor of $x$, you'll receive "Wrong answer" verdict!

Node $a$ is called an ancestor of node $b$ if $a \ne b$ and the shortest path from node $1$ to node $b$ passes through node $a$. Note that in this problem a node is not an ancestor of itself.

Can you find $x$ in no more than $36$ queries? The hidden node is fixed in each test beforehand and does not depend on your queries.

Input

The first line contains the integer $n$ ($2 \le n \le 2 \cdot 10^5$) — the number of nodes in the tree.

Each of the next $n-1$ lines contains two space-separated integers $u$ and $v$ ($1 \le u,v \le n$) that mean there's an edge between nodes $u$ and $v$. It's guaranteed that the given graph is a tree.

Output

To print the answer, print "! x" (without quotes).

Interaction

To ask a question, print it in one of the formats above:

* d $u$ ($1 \le u \le n$), or
* s $u$ ($1 \le u \le n$).

After each question, you should read the answer: either the distance or the second vertex on the path, as mentioned in the legend.

If we answer with $-1$ instead of a valid answer, that means you exceeded the number of queries, made an invalid query, or violated the condition in the second type of queries. Exit immediately after receiving $-1$ and you will see Wrong answer verdict. Otherwise, you can get an arbitrary verdict because your solution will continue to read from a closed stream.

After printing a query, 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

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

Output

```
d 2
s 3
! 5
```

Note

In the first example, the hidden node is node $5$.

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

We first ask about the distance between node $x$ and node $2$. The answer is $3$, so node $x$ is either $4$ or $5$. We then ask about the second node in the path from node $3$ to node $x$. Note here that node $3$ is an ancestor of node $5$. We receive node $5$ as the answer. Finally, we report that the hidden node is node $5$.

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

static long long queries = 0;

static long long query_limit = 36;

static const int HARD_CAP = 100000;

static const int MAXN = 200005;
static const int LOGN = 20;

int n;
vector<int> adj[MAXN];
int hidden_x;

int tin[MAXN], dfs_out[MAXN];
int timer_dfs = 0;
int up[MAXN][LOGN];
int depth[MAXN];

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());
}

static void build_rooted_tree(int root) {
    timer_dfs = 0;

    vector<int> parent(n + 1, 0);
    vector<int> it(n + 1, 0);
    vector<int> st;
    st.reserve(n);

    parent[root] = root;
    depth[root] = 0;
    up[root][0] = root;
    for (int i = 1; i < LOGN; i++) up[root][i] = root;
    tin[root] = ++timer_dfs;
    st.push_back(root);

    while (!st.empty()) {
        int u = st.back();
        if (it[u] < (int)adj[u].size()) {
            int v = adj[u][it[u]++];
            if (v == parent[u]) continue;
            parent[v] = u;
            depth[v] = depth[u] + 1;
            up[v][0] = u;
            for (int i = 1; i < LOGN; i++) {
                up[v][i] = up[up[v][i - 1]][i - 1];
            }
            tin[v] = ++timer_dfs;
            st.push_back(v);
        } else {
            dfs_out[u] = timer_dfs;
            st.pop_back();
        }
    }
}

bool is_ancestor_reflexive(int u, int v) {
    return tin[u] <= tin[v] && dfs_out[u] >= dfs_out[v];
}

int get_lca(int u, int v) {
    if (is_ancestor_reflexive(u, v)) return u;
    if (is_ancestor_reflexive(v, u)) return v;
    for (int i = LOGN - 1; i >= 0; i--) {
        if (!is_ancestor_reflexive(up[u][i], v)) {
            u = up[u][i];
        }
    }
    return up[u][0];
}

int get_dist(int u, int v) {
    return depth[u] + depth[v] - 2 * depth[get_lca(u, v)];
}

int get_kth_ancestor(int node, int k) {
    for (int i = 0; i < LOGN; i++) {
        if ((k >> i) & 1) {
            node = up[node][i];
        }
    }
    return node;
}

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

    n = inf.readInt(2, 200000, "n");
    vector<pair<int, int>> edges;
    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);
        edges.push_back({u, v});
    }
    hidden_x = inf.readInt(1, n, "x");

    build_rooted_tree(1);

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

    log_metrics();

    while (true) {
        string token;
        if (!(cin >> token)) {

            finish(_wa, "Unexpected EOF: expected query or answer token");
        }

        if (token == "?") {
            if (!(cin >> token)) {
                finish(_wa, "Unexpected EOF after '?'");
            }
        }

        if (token == "!") {
            int ans;
            if (!(cin >> ans)) finish(_wa, "Unexpected EOF reading answer value");

            if (ans == hidden_x) {
                finish(_ok, "Correct answer");
            } else {
                finish(_wa, format("Wrong answer: expected %d, found %d", hidden_x, ans));
            }
        }

        if (token != "d" && token != "s") {
            finish(_wa, format("Invalid query token: '%s'", token.c_str()));
        }

        int u;
        if (!(cin >> u)) {
            finish(_wa, "Unexpected EOF reading query parameter");
        }

        queries++;

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

        if (queries > HARD_CAP) {
            finish(_pe, "Too many queries (hard cap exceeded)");
        }

        if (u < 1 || u > n) {
            finish(_wa, format("Invalid node index: %d", u));
        }

        if (token == "d") {

            int d = get_dist(u, hidden_x);
            cout << d << endl;
        } else {

            if (u == hidden_x || !is_ancestor_reflexive(u, hidden_x)) {
                finish(_wa, format("Query 's %d' invalid: %d is not a proper ancestor of hidden node", u, u));
            }

            int k = depth[hidden_x] - (depth[u] + 1);

            int ans = get_kth_ancestor(hidden_x, k);
            cout << ans << endl;
        }
    }

    return 0;
}

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

const int MAXN = 200005;
const int LOGN = 20;

int n;
vector<int> adj[MAXN];
int up[MAXN][LOGN];

int tin[MAXN], tout_dfs[MAXN];
int depth[MAXN];
int timer_dfs;

vector<int> candidates;
long long queries = 0;
long long query_limit = 36;

static void build_rooted_tree(int root) {
    timer_dfs = 0;

    vector<int> parent(n + 1, 0);
    vector<int> it(n + 1, 0);
    vector<int> st;
    st.reserve(n);

    parent[root] = root;
    depth[root] = 0;
    up[root][0] = root;
    for (int i = 1; i < LOGN; i++) up[root][i] = root;
    tin[root] = ++timer_dfs;
    st.push_back(root);

    while (!st.empty()) {
        int u = st.back();
        if (it[u] < (int)adj[u].size()) {
            int v = adj[u][it[u]++];
            if (v == parent[u]) continue;
            parent[v] = u;
            depth[v] = depth[u] + 1;
            up[v][0] = u;
            for (int i = 1; i < LOGN; i++) {
                up[v][i] = up[up[v][i - 1]][i - 1];
            }
            tin[v] = ++timer_dfs;
            st.push_back(v);
        } else {
            tout_dfs[u] = timer_dfs;
            st.pop_back();
        }
    }
}

bool is_ancestor(int u, int v) {
    return tin[u] <= tin[v] && tout_dfs[u] >= tout_dfs[v];
}

int get_lca(int u, int v) {
    if (is_ancestor(u, v)) return u;
    if (is_ancestor(v, u)) return v;
    for (int i = LOGN - 1; i >= 0; i--) {
        if (!is_ancestor(up[u][i], v)) {
            u = up[u][i];
        }
    }
    return up[u][0];
}

int get_dist(int u, int v) {
    return depth[u] + depth[v] - 2 * depth[get_lca(u, v)];
}

int get_child_towards(int u, int v) {
    int target_d = depth[u] + 1;
    int temp = v;

    for (int i = LOGN - 1; i >= 0; i--) {
        if (depth[temp] - (1 << i) >= target_d) {
            temp = up[temp][i];
        }
    }
    return temp;
}

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());
}

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

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

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

    for(int i = 1; i <= n; ++i) candidates.push_back(i);

    build_rooted_tree(1);

    log_metrics();

    while (true) {
        string type;

        if (!(cin >> type)) {

            finish(_wa, "Unexpected EOF: expected query token");
        }

        if (type == "!") {
            int ans;
            if (!(cin >> ans)) finish(_wa, "Unexpected EOF reading answer");

            bool possible = false;
            for(int c : candidates) {
                if(c == ans) possible = true;
            }

            if (possible && candidates.size() == 1) {
                finish(_ok, "Correct answer");
            } else {
                finish(_wa, "Wrong answer: " + to_string(candidates.size()) + " candidates remained");
            }

        } else if (type == "d" || type == "s") {
            int u;
            if (!(cin >> u)) finish(_wa, "Unexpected EOF reading u");

            if (u < 1 || u > n) {
                cout << -1 << endl;
                finish(_wa, "Invalid node index");
            }

            queries++;

            if (queries > query_limit) {
                cout << -1 << endl;
                finish(_wa, "Query limit exceeded");
            }

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

            if (type == "d") {

                map<int, int> counts;
                for(int c : candidates) {
                    counts[get_dist(u, c)]++;
                }

                int best_d = -1;
                int max_sz = -1;

                for(auto const& [d, count] : counts) {
                    if (count > max_sz) {
                        max_sz = count;
                        best_d = d;
                    }
                }

                cout << best_d << endl;

                vector<int> next_cand;
                next_cand.reserve(max_sz);
                for(int c : candidates) {
                    if (get_dist(u, c) == best_d) {
                        next_cand.push_back(c);
                    }
                }
                candidates = next_cand;

            } else {

                vector<int> invalid_cand;

                for(int c : candidates) {
                    if (u != c && is_ancestor(u, c)) {

                    } else {
                        invalid_cand.push_back(c);
                    }
                }

                if (!invalid_cand.empty()) {

                    candidates = invalid_cand;
                    cout << -1 << endl;
                    finish(_wa, "Invalid query: u is not a strict ancestor of hidden node");
                } else {

                    map<int, int> child_counts;
                    for(int c : candidates) {
                        int child = get_child_towards(u, c);
                        child_counts[child]++;
                    }

                    int best_child = -1;
                    int max_sz = -1;

                    for(auto const& [child, count] : child_counts) {
                        if (count > max_sz) {
                            max_sz = count;
                            best_child = child;
                        }
                    }

                    cout << best_child << endl;

                    vector<int> next_cand;
                    next_cand.reserve(max_sz);
                    for(int c : candidates) {
                        if (get_child_towards(u, c) == best_child) {
                            next_cand.push_back(c);
                        }
                    }
                    candidates = next_cand;
                }
            }

        } else {
            finish(_wa, "Invalid query type");
        }
    }

    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", 200000);
    long long seed = atoll(argv[1]);

    int type = 0;
    if (seed == 1) {
        n = 10;
        type = 1;
    } else if (seed == 2) {
        type = 2;
    } else if (seed == 3) {
        type = 3;
    } else {
        int strat = (seed % 4);
        if (strat == 0) type = 4;
        else if (strat == 1) type = 5;
        else if (strat == 2) type = 6;
        else type = 2;
    }

    vector<pair<int, int>> edges;
    int x = -1;

    if (type == 1 || type == 5) {

        for (int i = 2; i <= n; i++) {
            int p;
            if (type == 5) {
                int range = min(i - 1, 20);
                p = rnd.next(max(1, i - range), i - 1);
            } else {
                p = rnd.next(1, i - 1);
            }
            edges.push_back({p, i});
        }
        x = rnd.next(2, n);
    }
    else if (type == 2) {
        for (int i = 2; i <= n; i++) {
            edges.push_back({i - 1, i});
        }
        x = n;
    }
    else if (type == 3) {
        for (int i = 2; i <= n; i++) {
            edges.push_back({1, i});
        }
        x = rnd.next(2, n);
    }
    else if (type == 4) {

        for (int i = 2; i <= n; i++) {
            edges.push_back({i / 2, i});
        }

        x = rnd.next(n / 2 + 1, n);
    }
    else if (type == 6) {

        int u = 1;
        int rem = n - 1;
        int next_id = 2;

        while (rem > 0) {
            if (rem == 1) {
                edges.push_back({u, next_id});
                u = next_id;
                next_id++;
                rem--;
                break;
            }

            int sub_growth = (rem - 2) / 2;
            int heavy_sz = (rem - 1) - sub_growth;

            int heavy_root = next_id++;
            edges.push_back({u, heavy_root});

            int cur_h = heavy_root;
            for (int k = 0; k < heavy_sz - 1; k++) {
                edges.push_back({cur_h, next_id});
                cur_h = next_id;
                next_id++;
            }

            int v = next_id++;
            edges.push_back({u, v});
            u = v;

            rem -= (heavy_sz + 1);
        }
        x = u;
    }

    vector<int> p(n + 1);
    for (int i = 1; i <= n; i++) p[i] = i;
    shuffle(p.begin() + 2, 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());

    if (x != -1) x = p[x];

    cout << n << "\n";
    for (auto e : final_edges) {
        cout << e.first << " " << e.second << "\n";
    }

    if (mode == "non") {
        cout << x << "\n";
    }

    return 0;
}


This is the easy version of the problem. The only difference between the two versions is that in this version, you can make at most $\mathbf{10}$ queries.

This is an interactive problem. If you are unsure how interactive problems work, then it is recommended to read the guide for participants.

We have a secret ruler that is missing one number $x$ ($2 \leq x \leq 999$). When you measure an object of length $y$, the ruler reports the following values:

* If $y < x$, the ruler (correctly) measures the object as having length $y$.
* If $y \geq x$, the ruler incorrectly measures the object as having length $y+1$.![](https://espresso.codeforces.com/a98908c8e65eba44622cf7a3ee2ee84099990643.png)

The ruler above is missing the number $4$, so it correctly measures the first segment as length $3$ but incorrectly measures the second segment as length $6$ even though it is actually $5$.

You need to find the value of $x$. To do that, you can make queries of the following form:

* $\texttt{?}~a~b$ — in response, we will measure the side lengths of an $a \times b$ rectangle with our ruler and multiply the results, reporting the measured area of the rectangle back to you. For example, if $x=4$ and you query a $3 \times 5$ rectangle, we will measure its side lengths as $3 \times 6$ and report $18$ back to you.

Find the value of $x$. You can ask at most $\mathbf{10}$ queries.

Input

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

Interaction

There is no initial input for each test case. You should begin the interaction by asking a query.

To make a query, output a single line of the form $\texttt{?}~a~b$ ($1 \leq a, b \leq 1000$). In response, you will be told the measured area of the rectangle, according to our secret ruler.

When you are ready to print the answer, output a single line of the form $\texttt{!}~x$ ($2 \leq x \leq 999$). After that, proceed to process the next test case or terminate the program if it was the last test case. Printing the answer does not count as a query.

The interactor is not adaptive, meaning that the answer is known before the participant asks the queries and doesn't depend on the queries asked by the participant.

If your program makes more than $10$ queries for one set of input data, makes an invalid query, or prints the wrong value of $x$, then the response to the query will be $-1$. After receiving such a response, your program should immediately terminate to receive the verdict Wrong Answer. Otherwise, you can get an arbitrary verdict because your solution will continue to read from a closed stream.

After printing a query do not forget to output the end of line and flush the output. Otherwise, you may get Idleness limit exceeded verdict. 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

```
2

18

25

9999
```

Output

```? 3 5? 4 4! 4? 99 100! 100
```

Note

In the first test, the interaction proceeds as follows.

|  |  |  |
| --- | --- | --- |
| Solution | Jury | Explanation |
|  | $\texttt{2}$ | There are 2 test cases. |
| $\texttt{? 3 5}$ | $\texttt{18}$ | Secretly, the jury picked $x=4$. The solution requests the $3 \times 5$ rectangle, and the jury responds with $3 \times 6 = 18$, as described in the statement. |
| $\texttt{? 4 4}$ | $\texttt{25}$ | The solution requests the $4 \times 4$ rectangle, which the jury measures as $5 \times 5$ and responds with $25$. |
| $\texttt{! 4}$ |  | The solution has somehow determined that $x=4$, and outputs it. Since the output is correct, the jury continues to the next test case. |
| $\texttt{? 99 100}$ | $\texttt{1}$ | Secretly, the jury picked $x=100$. The solution requests the $99 \times 100$ rectangle, which the jury measures as $99 \times 101$ and responds with $9999$. |
| $\texttt{! 100}$ |  | The solution has somehow determined that $x=100$, and outputs it. Since the output is correct and there are no more test cases, the jury and the solution exit. |

Note that the line breaks in the example input and output are for the sake of clarity, and do not occur in the real interaction.

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

using namespace std;

static long long max_queries_used = 0;

static const long long query_limit = 10;

static const long long HARD_CAP = 200000;

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

    }
}

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

static long long measure(long long val, int x) {
    if (val < x) return val;
    return val + 1;
}

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

    registerInteraction(argc, argv);

    atexit(log_metrics);

    int t = inf.readInt();

    cout << t << endl;

    log_metrics();

    long long total_ops = 0;

    for (int i = 0; i < t; i++) {

        int x = inf.readInt();
        int current_case_queries = 0;
        bool case_solved = false;

        while (!case_solved) {

            if (total_ops > HARD_CAP) {
                finish(_pe, "Hard cap on interactions exceeded.");
            }
            total_ops++;

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

            if (token == "!") {

                int guess;
                if (!(cin >> guess)) {
                    finish(_wa, "Failed to read answer value.");
                }

                if (guess != x) {
                    finish(_wa, format("Wrong answer on test case %d. Expected %d, found %d.", i + 1, x, guess));
                } else {

                    case_solved = true;
                }
            } else {

                int a, b;

                if (token == "?") {
                    if (!(cin >> a >> b)) {
                        finish(_wa, "Failed to read query arguments.");
                    }
                } else {

                    try {
                        size_t idx;
                        a = stoi(token, &idx);
                        if (idx != token.size()) throw exception();
                    } catch (...) {
                        finish(_wa, "Invalid token received: " + token);
                    }
                    if (!(cin >> b)) {
                        finish(_wa, "Failed to read second query argument.");
                    }
                }

                if (a < 1 || a > 1000 || b < 1 || b > 1000) {
                    finish(_wa, format("Query arguments out of range [1, 1000]: %d %d", a, b));
                }

                current_case_queries++;
                if (current_case_queries > max_queries_used) {
                    max_queries_used = current_case_queries;

                    log_metrics();
                }

                long long val_a = measure(a, x);
                long long val_b = measure(b, x);
                long long area = val_a * val_b;

                cout << area << endl;
            }
        }
    }

    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 t = opt<int>("t", 100);

    if (t < 1) t = 1;
    if (t > 1000) t = 1000;

    cout << t << endl;

    if (mode == "adp") {

        for (int i = 0; i < t; i++) {
            cout << "2 999" << endl;
        }
    } else {

        vector<int> cases;

        if (t >= 998) {

            for (int x = 2; x <= 999; x++) {
                cases.push_back(x);
            }

            while ((int)cases.size() < t) {
                cases.push_back(rnd.next(2, 999));
            }
        } else {

            cases.push_back(2);
            cases.push_back(999);

            int specials[] = {3, 9, 27, 81, 243, 729};
            for (int val : specials) {
                if (val >= 2 && val <= 999) {
                    cases.push_back(val);
                }
            }

            while ((int)cases.size() < t) {
                cases.push_back(rnd.next(2, 999));
            }
        }

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

        if ((int)cases.size() > t) {
            cases.resize(t);
        }

        for (int x : cases) {
            cout << x << endl;
        }
    }

    return 0;
}