### Problem Statement

This problem is an **interactive problem** (in which your program and the judge system communicate via input and output).

You are given a tree $G$ with $N$ vertices numbered $1$ to $N$. The $i$-th edge connects vertices $U_i$ and $V_i$.

You will play a game with Takahashi using this tree $G$. First, you decide who is first and who is second. Then, starting from the first player, take turns performing the following operation:

* Choose a pair of integers $(i,j)$ with $1 \leq i < j \leq N$ that satisfies both of the following conditions, then add an edge connecting vertices $i$ and $j$ to $G$.
  + $G$ does not already have an edge connecting vertices $i$ and $j$.
  + Adding an edge connecting vertices $i$ and $j$ does not create an odd cycle.

A player who cannot perform this operation loses, and the other player wins. Play this game against Takahashi and win.

What is an odd cycle?

A sequence of vertices $(v_0,v_1,\ldots,v_k)$ of $G$ is called an odd cycle if and only if all of the following conditions are satisfied:

* $k$ is odd.
* $v_0=v_k$.
* For every $1\leq i \leq k$, there is an edge connecting $v_{i-1}$ and $v_{i}$.

### Constraints

* $2 \leq N \leq 100$
* $1 \leq U_i < V_i \leq N$
* The given graph is a tree.
* All input values are integers.

### Interaction

This is an interactive problem (in which your program and the judge system communicate via input and output).

First, read $N$ and the edges of $G$ from Standard Input, given in the following format:

```
$N$
$U_1$ $V_1$
$U_2$ $V_2$
$\vdots$
$U_{N-1}$ $V_{N-1}$
```

Then, decide whether you go first or second. If you choose first, print `First`; if second, print `Second`.

Then, the game begins.

On your turn, output the chosen pair $(i,j)$ by printing two integers $i$ and $j$ in this order, separated by a space:

```
$i$ $j$
```

On Takahashi's turn, two integers $i,j$ will be given in order, separated by a space, via Standard Input:

```
$i$ $j$
```

If $(i,j)=(-1,-1)$, it means he can no longer make a move and you win. Immediately terminate your program in this case.
Otherwise, $(i,j)$ is the pair of integers he has chosen.

### Notes

* **After each output, be sure to print a newline and flush Standard Output. Otherwise, you may get TLE.**
* **If you produce output in an incorrect format or your program ends prematurely, the judge result is indeterminate.**
* Once the game finishes, terminate your program immediately. Otherwise, the judge result is indeterminate.

### Sample Interaction

| Input | Output | Explanation |
| --- | --- | --- |
| `4 1 2 2 3 3 4` |  | First, you receive $N$ and the edges of $G$. |
|  | `First` | You choose to go first. |
|  | `1 4` | You add an edge between vertices $1$ and $4$. |
| `-1 -1` |  | Takahashi can no longer move, so you win. The judge result will be AC. |

#include "testlib.h"

#include <bits/stdc++.h>
#include <csignal>

using namespace std;

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

static string to_lower_ascii(string s) {
    for (char& c : s) c = (char)tolower((unsigned char)c);
    return s;
}

int main(int argc, char** argv) {
    registerInteraction(argc, argv);
    atexit(log_metrics);
#ifdef SIGPIPE
    signal(SIGPIPE, SIG_IGN);
#endif

    const int N = inf.readInt();
    if (N < 2 || N > 100) finish(_fail, "invalid N in hidden input");

    vector<pair<int, int>> edges;
    edges.reserve(max(0, N - 1));
    vector<vector<int>> adj(N + 1);
    vector<vector<unsigned char>> has_edge(N + 1, vector<unsigned char>(N + 1, 0));
    for (int i = 0; i < N - 1; i++) {
        int u = inf.readInt();
        int v = inf.readInt();
        if (u < 1 || u > N || v < 1 || v > N || u == v) finish(_fail, "invalid edge in hidden input");
        if (u > v) swap(u, v);
        if (has_edge[u][v]) finish(_fail, "duplicate edge in hidden input");
        has_edge[u][v] = has_edge[v][u] = 1;
        edges.push_back({u, v});
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

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

    vector<int> color(N + 1, -1);
    queue<int> q;
    color[1] = 0;
    q.push(1);
    while (!q.empty()) {
        int x = q.front();
        q.pop();
        for (int y : adj[x]) {
            if (color[y] == -1) {
                color[y] = color[x] ^ 1;
                q.push(y);
            } else if (color[y] == color[x]) {
                finish(_fail, "hidden input graph is not bipartite");
            }
        }
    }
    for (int i = 1; i <= N; i++) {
        if (color[i] == -1) finish(_fail, "hidden input graph is not connected");
    }

    set<pair<int, int>> remaining;
    for (int i = 1; i <= N; i++) {
        for (int j = i + 1; j <= N; j++) {
            if (color[i] == color[j]) continue;
            if (has_edge[i][j]) continue;
            remaining.insert({i, j});
        }
    }
    query_limit = (long long)remaining.size();
    log_metrics();

    string role;
    if (!(cin >> role)) finish(_pe, "EOF (expected First/Second)");
    role = to_lower_ascii(role);

    bool contestant_first = false;
    if (role == "first") {
        contestant_first = true;
    } else if (role == "second") {
        contestant_first = false;
    } else {
        finish(_pe, "Invalid role (expected First/Second)");
    }

    bool contestant_turn = contestant_first;
    while (true) {
        if (contestant_turn) {
            int x, y;
            if (!(cin >> x >> y)) finish(_pe, "EOF (expected move)");

            if (x == -1 && y == -1) {
                if (remaining.empty()) finish(_wa, "Contestant cannot move (loses)");
                finish(_wa, "Contestant resigned with moves remaining");
            }

            if (x < 1 || x > N || y < 1 || y > N || x >= y) finish(_pe, "Invalid move format");
            if (has_edge[x][y]) finish(_wa, "Edge already exists");
            if (color[x] == color[y]) finish(_wa, "Move creates an odd cycle");

            auto it = remaining.find({x, y});
            if (it == remaining.end()) finish(_wa, "Illegal move");
            remaining.erase(it);
            has_edge[x][y] = has_edge[y][x] = 1;
            queries++;
            if (queries % 64 == 0) log_metrics();

            contestant_turn = false;
            continue;
        }

        if (remaining.empty()) {
            cout << -1 << " " << -1 << endl;
            finish(_ok, "Contestant wins");
        }

        auto mv = *remaining.begin();
        remaining.erase(remaining.begin());
        has_edge[mv.first][mv.second] = has_edge[mv.second][mv.first] = 1;
        cout << mv.first << " " << mv.second << endl;
        if (!cout) finish(_pe, "Broken pipe while writing move");
        contestant_turn = true;
    }
}

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

    long long seed_val = stoll(argv[1]);

    int N;
    int type = -1;

    if (seed_val == 1) {
        N = 2; type = 3;
    } else if (seed_val == 2) {
        N = 3; type = 3;
    } else if (seed_val == 3) {
        N = 4; type = 2;
    } else if (seed_val == 4) {
        N = 100; type = 3;
    } else if (seed_val == 5) {
        N = 100; type = 2;
    } else {

        int t = rnd.next(100);
        if (t < 10) N = rnd.next(2, 10);
        else if (t < 30) N = rnd.next(11, 50);
        else N = rnd.next(51, 100);

        int r = rnd.next(100);
        if (r < 50) type = 0;
        else if (r < 80) type = 1;
        else if (r < 90) type = 2;
        else type = 3;
    }

    vector<pair<int, int>> edges;

    if (type == 2) {

        for (int i = 2; i <= N; i++) edges.push_back({1, i});
    } else if (type == 3) {

        for (int i = 2; i <= N; i++) edges.push_back({i - 1, i});
    } else if (type == 1) {

        int size_L = rnd.next(1, N - 1);

        vector<int> L_nodes, R_nodes;
        for (int i = 1; i <= size_L; i++) L_nodes.push_back(i);
        for (int i = size_L + 1; i <= N; i++) R_nodes.push_back(i);

        shuffle(L_nodes.begin(), L_nodes.end());
        shuffle(R_nodes.begin(), R_nodes.end());

        vector<int> connected_L, connected_R;
        vector<int> rem_L = L_nodes, rem_R = R_nodes;

        int u = rem_L.back(); rem_L.pop_back();
        int v = rem_R.back(); rem_R.pop_back();
        edges.push_back({u, v});
        connected_L.push_back(u);
        connected_R.push_back(v);

        while (!rem_L.empty() || !rem_R.empty()) {
            bool pick_L = false;
            if (rem_L.empty()) pick_L = false;
            else if (rem_R.empty()) pick_L = true;
            else pick_L = (rnd.next(2) == 0);

            if (pick_L) {
                int curr = rem_L.back(); rem_L.pop_back();
                int target = connected_R[rnd.next(connected_R.size())];
                edges.push_back({curr, target});
                connected_L.push_back(curr);
            } else {
                int curr = rem_R.back(); rem_R.pop_back();
                int target = connected_L[rnd.next(connected_L.size())];
                edges.push_back({curr, target});
                connected_R.push_back(curr);
            }
        }
    } else {

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

    vector<int> p(N);
    iota(p.begin(), p.end(), 1);
    shuffle(p.begin(), p.end());

    cout << N << endl;
    for (auto& e : edges) {
        int u = p[e.first - 1];
        int v = p[e.second - 1];
        if (u > v) swap(u, v);
        cout << u << " " << v << endl;
    }

    return 0;
}


You should process *m* queries over a set *D* of strings. Each query is one of three kinds:

1. Add a string *s* to the set *D*. It is guaranteed that the string *s* was not added before.
2. Delete a string *s* from the set *D*. It is guaranteed that the string *s* is in the set *D*.
3. For the given string *s* find the number of occurrences of the strings from the set *D*. If some string *p* from *D* has several occurrences in *s* you should count all of them.

Note that you should solve the problem in online mode. It means that you can't read the whole input at once. You can read each query only after writing the answer for the last query of the third type. Use functions fflush in C++ and BufferedWriter.flush in Java languages after each writing in your program.

Input

The first line contains integer *m* (1 ≤ *m* ≤ 3·105) — the number of queries.

Each of the next *m* lines contains integer *t* (1 ≤ *t* ≤ 3) and nonempty string *s* — the kind of the query and the string to process. All strings consist of only lowercase English letters.

The sum of lengths of all strings in the input will not exceed 3·105.

Output

For each query of the third kind print the only integer *c* — the desired number of occurrences in the string *s*.

Examples

Input

```
5
1 abc
3 abcabc
2 abc
1 aba
3 abababc
```

Output

```
2
2
```

Input

```
10
1 abc
1 bcd
1 abcd
3 abcd
2 abcd
3 abcd
2 bcd
3 abcd
2 abc
3 abcd
```

Output

```
3
2
1
0
```

#include "testlib.h"
#include <csignal>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

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

void log_queries() {
    tout << "queries=" << queries << "\n";
    tout << "query_limit=" << query_limit << "\n";
}

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

int main(int argc, char* argv[]) {
    registerInteraction(argc, argv);
    signal(SIGPIPE, SIG_IGN);
    atexit(log_queries);

    const int m = inf.readInt();
    cout << m << "\n" << flush;

    for (int i = 0; i < m; i++) {
        const int t = inf.readInt();
        const string s = inf.readToken();
        cout << t << " " << s << "\n" << flush;
        if (t == 3) {
            long long out;
            if (!(cin >> out)) {
                quit_with(_wa, "Missing outputs");
            }
            queries++;
        }
    }
    query_limit = queries;
    quit_with(_ok, "Best-effort accepted");
}

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

    if (seed == 1) {
        cout << "5\n";
        cout << "1 abc\n";
        cout << "3 abcabc\n";
        cout << "2 abc\n";
        cout << "1 aba\n";
        cout << "3 abababc\n";
        return 0;
    }
    if (seed == 2) {
        cout << "6\n";
        cout << "1 a\n";
        cout << "1 b\n";
        cout << "3 ab\n";
        cout << "2 a\n";
        cout << "3 ab\n";
        cout << "2 b\n";
        return 0;
    }

    const int MAX_M = 300000;
    const int MAX_TOTAL_LEN = 300000;

    int alphabet_size = 26;
    if (mode == "adp") {

        alphabet_size = 2;
    } else {

        int r = rnd.next(10);
        if (r < 2) alphabet_size = 2;
        else if (r < 4) alphabet_size = 4;
        else alphabet_size = 26;
    }

    vector<string> active;
    vector<string> history;
    set<string> seen_adds;

    struct Op {
        int type;
        string s;
    };
    vector<Op> ops;

    long long current_total_len = 0;

    while (ops.size() < MAX_M && current_total_len < MAX_TOTAL_LEN - 5) {

        int w_add = 40;
        int w_del = 20;
        int w_qry = 40;

        if (active.empty()) w_del = 0;

        if (history.size() < 10) {
            w_add = 80; w_del = 0; w_qry = 20;
        }

        long long rem_len = MAX_TOTAL_LEN - current_total_len;
        if (rem_len < 100) {
            if (rem_len < 5) break;
            w_add = 1; w_del = 1; w_qry = 10;
        }

        int dice = rnd.next(w_add + w_del + w_qry);
        int type = 1;
        if (dice < w_add) type = 1;
        else if (dice < w_add + w_del) type = 2;
        else type = 3;

        string s = "";

        if (type == 1) {
            int len = rnd.next(1, 10);

            if (rnd.next(20) == 0 && rem_len >= 10) len = rnd.next(10, min((int)rem_len, 300));
            if (len > rem_len) len = (int)rem_len;
            if (len < 1) len = 1;

            bool unique_found = false;
            for (int k = 0; k < 20; ++k) {
                string tmp = "";
                for (int i = 0; i < len; ++i) tmp += (char)('a' + rnd.next(alphabet_size));
                if (seen_adds.find(tmp) == seen_adds.end()) {
                    s = tmp;
                    unique_found = true;
                    break;
                }
            }
            if (!unique_found) continue;

            seen_adds.insert(s);
            active.push_back(s);
            history.push_back(s);

        } else if (type == 2) {
            if (active.empty()) continue;
            int idx = rnd.next(active.size());
            s = active[idx];

            active[idx] = active.back();
            active.pop_back();

        } else {
            int len = rnd.next(1, 50);
            if (rnd.next(20) == 0 && rem_len >= 50) len = rnd.next(50, min((int)rem_len, 1000));
            if (len > rem_len) len = (int)rem_len;
            if (len < 1) len = 1;

            if (history.empty() || rnd.next(5) == 0) {

                for (int i = 0; i < len; ++i) s += (char)('a' + rnd.next(alphabet_size));
            } else {

                while (s.length() < (size_t)len) {
                    string part = history[rnd.next(history.size())];
                    if (s.length() + part.length() > (size_t)len) {

                        while(s.length() < (size_t)len) s += (char)('a' + rnd.next(alphabet_size));
                        break;
                    }
                    s += part;
                }
            }
        }

        if (current_total_len + s.length() > MAX_TOTAL_LEN) break;

        ops.push_back({type, s});
        current_total_len += s.length();
    }

    cout << ops.size() << "\n";
    for (const auto& op : ops) {
        cout << op.type << " " << op.s << "\n";
    }

    return 0;
}


### Problem Statement

This problem is **interactive**, and the **judge is adaptive**. See the notes for details.
**Also, the parameters in the problem statement are fixed at $N=1000$, $M=10$, $Q=950$.**

There are $N$ coins numbered $1, 2, \dots, N$.
Exactly $M$ of these coins are counterfeit.

An appraiser can, in one appraisal, determine whether two coins are of the same type or different types. Specifically:

* If the two coins are both genuine or both counterfeit, they are judged to be of the same type.
* Otherwise, they are judged to be of different types.

Identify all the counterfeit coins using at most $Q$ appraisals.

### Constraints

* $\color{red}{N = 1000}$
* $\color{red}{M = 10}$
* $\color{red}{Q = 950}$

### Interaction

This is an interactive problem.
Initially, receive $N$, $M$, and $Q$ from Standard Input:

```
$N$ $M$ $Q$
```

Next, you can perform appraisals between $0$ and $Q$ times, inclusive, as follows.

First, by outputting to Standard Output in the following format, you indicate that you are appraising coins $x$ and $y$. (Include a newline at the end.)

```
? $x$ $y$
```

Here, $x$ and $y$ must be distinct integers between $1$ and $N$, inclusive.

In response, the judge system will reply with one of the following three responses.

```
0
```

If the response is `0`, it means that coins $x$ and $y$ are of the same type.

```
1
```

If the response is `1`, it means that coins $x$ and $y$ are of different types.

```
-1
```

If the response is `-1`, it means that the appraisal is invalid. Specifically, this response is given when at least one of the following conditions is met:

* The outputted $x$ and $y$ does not satisfy the constraints.
* The number of appraisals exceeds $Q$.

If you receive this response, your program is considered incorrect. Terminate your program immediately.

Finally, by outputting to Standard Output in the following format, you answer that coins $A_1, A_2, \dots, A_{M}$ are counterfeit. (Include a newline at the end.)

```
! $A_1$ $A_2$ $\dots$ $A_{M}$
```

Here, $A_i$ must be distinct integers between $1$ and $N$, inclusive.
After this output, terminate your program immediately.

If any of your outputs do not meet the specified format, your program will be considered incorrect.
The judge will then respond with `-1`, so in that case, terminate your program immediately.

### Notes

* **Every time you output, include a newline at the end and flush Standard Output.** Failure to do so may result in a verdict of TLE or WA.
* After outputting your answer (or receiving `-1`), terminate your program immediately. Otherwise, the verdict is indeterminate.
* Beware that unnecessary newlines are considered as malformed.
* **The judge for this problem is adaptive.** That is, at any point, as long as consistency can be maintained, the judge may change which coins are counterfeit. See the sample interaction for details.

### Sample Interaction

In this interaction, $N=5$, $M=2$, $Q=10$, and the judge initially considers coins $1$ and $2$ to be counterfeit.

Note that this example does not meet the constraints and is not included in the judge.

| Input | Output | Explanation |
| --- | --- | --- |
| `5 2 10` |  | $N$, $M$, and $Q$ are given. |
|  | `? 1 2` | You appraise coins $1$ and $2$. |
| `0` |  | Coins $1$ and $2$ are judged to be of the same type. |
|  | `? 1 3` | You appraise coins $1$ and $3$. |
| `1` |  | Coins $1$ and $3$ are judged to be of different types. |
|  | `? 1 4` | You appraise coins $1$ and $4$. |
| `1` |  | Coins $1$ and $4$ are judged to be of different types. |
|  | `! 1 2` | You answer that coins $1$ and $2$ are counterfeit. |
|  |  | Indeed, coins $1$ and $2$ are considered counterfeit, but it is also possible to consider coins $3$ and $4$ as counterfeit while maintaining consistency. Therefore, the judge may change the counterfeit coins to $3$ and $4$. As a result, the judge may judge this answer as incorrect. |

#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 MIN_HARD_CAP = 200000;
static const long long HARD_CAP_MULTIPLIER = 10;

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

    }
}

#define FINISH(verdict, ...) \
    do { \
        log_metrics(); \
        quitf(verdict, __VA_ARGS__); \
    } while (0)

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

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

    int N = inf.readInt();
    int M = inf.readInt();
    int Q = inf.readInt();

    query_limit = Q;

    log_metrics();

    vector<bool> is_counterfeit(N + 1, false);
    set<int> expected_counterfeit;
    for (int i = 0; i < M; ++i) {
        int c = inf.readInt();

        if (c < 1 || c > N) {
            FINISH(_fail, "Hidden input coin index %d out of range [1, %d]", c, N);
        }
        is_counterfeit[c] = true;
        expected_counterfeit.insert(c);
    }

    cout << N << " " << M << " " << Q << endl;

    long long hard_cap = max(MIN_HARD_CAP, HARD_CAP_MULTIPLIER * query_limit);

    while (true) {

        if (queries > hard_cap) {
            FINISH(_pe, "Hard query limit of %lld exceeded", hard_cap);
        }

        if (queries > 0 && queries % 10 == 0) {
            log_metrics();
        }

        string token;

        if (!(cin >> token)) {
             FINISH(_wa, "Unexpected EOF while reading request token");
        }

        if (token == "!") {

            vector<int> ans;
            set<int> ans_set;
            for (int i = 0; i < M; ++i) {
                int val;
                if (!(cin >> val)) {
                    FINISH(_wa, "Unexpected EOF while reading answer indices");
                }
                ans.push_back(val);
                ans_set.insert(val);
            }

            for (int x : ans) {
                if (x < 1 || x > N) {
                    FINISH(_wa, "Answer index %d out of range [1, %d]", x, N);
                }
            }
            if ((int)ans_set.size() != M) {
                FINISH(_wa, "Answer must contain exactly %d distinct indices", M);
            }

            if (ans_set == expected_counterfeit) {
                FINISH(_ok, "Correct answer");
            } else {
                FINISH(_wa, "Incorrect set of counterfeit coins");
            }

        } else {

            int u, v;

            if (token == "?") {

                if (!(cin >> u >> v)) {
                    FINISH(_wa, "Unexpected EOF reading query arguments after '?'");
                }
            } else {

                try {
                    size_t processed = 0;
                    u = stoi(token, &processed);

                    if (processed != token.size()) throw exception();
                } catch (...) {
                    FINISH(_wa, "Invalid token '%s' where integer expected", token.c_str());
                }

                if (!(cin >> v)) {
                    FINISH(_wa, "Unexpected EOF reading second query argument");
                }
            }

            if (u < 1 || u > N || v < 1 || v > N) {
                FINISH(_wa, "Query indices %d %d out of range [1, %d]", u, v, N);
            }
            if (u == v) {
                FINISH(_wa, "Query indices must be distinct: %d %d", u, v);
            }

            queries++;

            bool type_u = is_counterfeit[u];
            bool type_v = is_counterfeit[v];
            int result = (type_u == type_v) ? 0 : 1;

            cout << result << endl;
        }
    }

    return 0;
}

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

using namespace std;

static long long queries_count = 0;
static long long query_limit = 950;
static int N_val = 1000;
static int M_val = 10;
static const int HARD_CAP = 200000;

static void log_metrics() {

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

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

struct DSU {
    vector<int> parent;
    vector<int> edge_weight;

    vector<int> cnt0;
    vector<int> cnt1;

    void init(int n) {
        parent.resize(n + 1);
        iota(parent.begin(), parent.end(), 0);
        edge_weight.assign(n + 1, 0);
        cnt0.assign(n + 1, 1);
        cnt1.assign(n + 1, 0);
    }

    pair<int, int> find(int i) {
        if (parent[i] != i) {
            pair<int, int> root_res = find(parent[i]);
            parent[i] = root_res.first;
            edge_weight[i] = (edge_weight[i] + root_res.second) % 2;
        }
        return {parent[i], edge_weight[i]};
    }

    void unite(int u, int v, int w) {
        pair<int, int> root_u = find(u);
        pair<int, int> root_v = find(v);
        int ru = root_u.first;
        int rv = root_v.first;
        if (ru == rv) return;

        int du = root_u.second;
        int dv = root_v.second;

        int K = (w + du + dv) % 2;

        parent[rv] = ru;
        edge_weight[rv] = K;

        if (K == 0) {
            cnt0[ru] += cnt0[rv];
            cnt1[ru] += cnt1[rv];
        } else {
            cnt0[ru] += cnt1[rv];
            cnt1[ru] += cnt0[rv];
        }
    }
} dsu;

using CountT = double;

CountT solve_ways(int merge_u = -1, int merge_v = -1, int merge_w = -1) {

    vector<pair<int, int>> comps;
    comps.reserve(N_val);

    if (merge_u != -1) {
        int ru = merge_u;
        int rv = merge_v;
        int K = merge_w;

        int c0, c1;
        if (K == 0) {

            c0 = dsu.cnt0[ru] + dsu.cnt0[rv];
            c1 = dsu.cnt1[ru] + dsu.cnt1[rv];
        } else {

            c0 = dsu.cnt0[ru] + dsu.cnt1[rv];
            c1 = dsu.cnt1[ru] + dsu.cnt0[rv];
        }
        comps.push_back({c1, c0});
    }

    for (int i = 1; i <= N_val; i++) {
        if (dsu.parent[i] == i) {
            if (i == merge_u || i == merge_v) continue;
            comps.push_back({dsu.cnt1[i], dsu.cnt0[i]});
        }
    }

    vector<CountT> dp(M_val + 1, 0.0);
    dp[0] = 1.0;

    for (auto& p : comps) {
        int w_g = p.first;
        int w_c = p.second;

        vector<CountT> next_dp(M_val + 1, 0.0);
        bool possible = false;

        for (int k = 0; k <= M_val; k++) {
            if (dp[k] > 1e-9) {

                if (k + w_g <= M_val) {
                    next_dp[k + w_g] += dp[k];
                    possible = true;
                }

                if (k + w_c <= M_val) {
                    next_dp[k + w_c] += dp[k];
                    possible = true;
                }
            }
        }
        dp = next_dp;
        if (!possible) return 0.0;
    }

    return dp[M_val];
}

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

    if (!inf.eof()) {
        N_val = inf.readInt();
        M_val = inf.readInt();
        query_limit = inf.readInt();
    }

    dsu.init(N_val);

    cout << N_val << " " << M_val << " " << query_limit << endl;

    string token;
    while (cin >> token) {
        if (token == "?") {
            int u, v;
            if (!(cin >> u >> v)) finish(_pe, "invalid query params");

            queries_count++;
            if (queries_count > HARD_CAP) finish(_pe, "hard cap exceeded");

            if (u < 1 || u > N_val || v < 1 || v > N_val || u == v) {
                finish(_wa, "invalid query indices");
            }

            if (queries_count > query_limit) {

                cout << -1 << endl;

                finish(_ok, "query limit exceeded");
            }

            pair<int, int> r_u = dsu.find(u);
            pair<int, int> r_v = dsu.find(v);

            int ans = 0;

            if (r_u.first == r_v.first) {

                ans = (r_u.second + r_v.second) % 2;
            } else {

                int du = r_u.second;
                int dv = r_v.second;
                int K0 = (0 + du + dv) % 2;
                int K1 = (1 + du + dv) % 2;

                CountT w0 = solve_ways(r_u.first, r_v.first, K0);
                CountT w1 = solve_ways(r_u.first, r_v.first, K1);

                if (w0 < 0.5 && w1 < 0.5) {

                    ans = 0;
                } else if (w0 >= w1) {
                    ans = 0;
                } else {
                    ans = 1;
                }

                dsu.unite(u, v, ans);
            }

            cout << ans << endl;

        } else if (token == "!") {
            vector<int> A;
            for (int i = 0; i < M_val; i++) {
                int x;
                if (!(cin >> x)) finish(_pe, "invalid answer format");
                A.push_back(x);
            }

            sort(A.begin(), A.end());
            if (unique(A.begin(), A.end()) != A.end()) finish(_wa, "duplicate coins");
            if (!A.empty() && (A[0] < 1 || A.back() > N_val)) finish(_wa, "coins out of bounds");

            vector<bool> is_c(N_val + 1, false);
            for (int x : A) is_c[x] = true;

            vector<int> root_type(N_val + 1, -1);
            bool consistent = true;

            for (int i = 1; i <= N_val; i++) {
                auto res = dsu.find(i);
                int r = res.first;
                int d = res.second;
                int type_i = is_c[i] ? 1 : 0;

                int inferred_r = type_i ^ d;

                if (root_type[r] == -1) {
                    root_type[r] = inferred_r;
                } else {
                    if (root_type[r] != inferred_r) {
                        consistent = false;
                        break;
                    }
                }
            }

            if (!consistent) finish(_wa, "answer inconsistent with queries");

            CountT total = solve_ways();
            if (total > 1.5) {
                finish(_wa, "solution not unique");
            }

            finish(_ok, "correct");

        } else {
            finish(_pe, "unknown token");
        }
    }

    finish(_pe, "unexpected exit");
    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");

    const int N = 1000;
    const int M = 10;
    const int Q = 950;

    println(N, M, Q);

    auto generate_random = [&]() {
        vector<int> p(N);
        iota(p.begin(), p.end(), 1);
        shuffle(p.begin(), p.end());
        vector<int> res;
        for (int i = 0; i < M; ++i) res.push_back(p[i]);
        sort(res.begin(), res.end());
        return res;
    };

    vector<int> counterfeit;

    if (mode == "non") {

        long long seed_val = atoll(argv[1]);

        if (seed_val == 1) {

            for (int i = 1; i <= M; ++i)
                counterfeit.push_back(i);
        } else if (seed_val == 2) {

            for (int i = 0; i < M; ++i)
                counterfeit.push_back(N - i);
            sort(counterfeit.begin(), counterfeit.end());
        } else if (seed_val == 3) {

            for (int i = 0; i < M; ++i)
                counterfeit.push_back(1 + 2 * i);
        } else {

            counterfeit = generate_random();
        }
    } else {

        counterfeit = generate_random();
    }

    println(counterfeit);

    return 0;
}


This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the output. If you use some other programming language, consult its documentation. You may also refer to the guide on interactive problems: [link omitted].

The jury has chosen a string $s$ consisting of $n$ characters; each character of $s$ is a lowercase Latin letter. Your task is to guess this string; initially, you know only its length.

You may ask queries of two types:

* $1$ $i$ — the query of the first type, where $i$ is an integer from $1$ to $n$. In response to this query, the jury will tell you the character $s_i$;
* $2$ $l$ $r$ — the query of the second type, where $l$ and $r$ are integers such that $1 \le l \le r \le n$. In response to this query, the jury will tell you the number of different characters among $s_l, s_{l+1}, \dots, s_r$.

You are allowed to ask no more than $26$ queries of the first type, and no more than $6000$ queries of the second type. Your task is to restore the string $s$.

For each test in this problem, the string $s$ is fixed beforehand, and will be the same for every submission.

Input

Initially, the jury program sends one integer $n$ on a separate line — the size of $s$ ($1 \le n \le 1000$).

Output

To give the answer, print one line! s with a line break in the end, where $s$ should be the string picked by the jury. After that, your program should flush the output and terminate gracefully.

Interaction

To ask a query, you should send one line containing the query, in one of the following formats:

*? 1 i — for a query of the first type ($1 \le i \le n$);
*? 2 l r — for a query of the second type ($1 \le l \le r \le n$).

Don't forget to flush the output after sending the query line.

The answer to your query will be given on a separate line. For a query of the first type, the answer will be the character $s_i$. For a query of the second type, the answer will be an integer equal to the number of different characters among $s_l, s_{l+1}, \dots, s_r$.

You are allowed to ask no more than $26$ queries of the first type, and no more than $6000$ queries of the second type.

In case you ask too many queries, or the jury program fails to recognize your query format, the answer to your query will be one integer $0$. After receiving $0$ as the answer, your program should terminate immediately — otherwise you may receive verdict "Runtime error", "Time limit exceeded" or some other verdict instead of "Wrong answer".

Example

Input

```
5
4
u
2
g
e
s
1
```

Output

```? 2 1 5? 1 2? 2 1 2? 1 1? 1 3? 1 4? 2 4 5! guess
```

Note

Let's analyze the example of interaction.

The string chosen by the jury is guess, so initially the jury sends one integer $5$.

1. the first query is? 2 1 5, which means "count the number of different characters among $s_1, s_2, \dots, s_5$". The answer to it is $4$.
2. the second query is? 1 2, which means "tell which character is $s_2$". The answer to it is u.
3. the third query is? 2 1 2, which means "count the number of different characters among $s_1$ and $s_2$". The answer to it is $2$.
4. the fourth query is? 1 1, which means "tell which character is $s_1$". The answer to it is g.
5. the fifth query is? 1 3, which means "tell which character is $s_3$". The answer to it is e.
6. the sixth query is? 1 4, which means "tell which character is $s_4$". The answer to it is s.
7. the seventh query is? 2 4 5, which means "count the number of different characters among $s_4$ and $s_5$". The answer to it is $1$, so it's possible to deduce that $s_4$ is the same as $s_5$.

In the end, the answer is submitted as! guess, and it is deduced correctly.

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

using namespace std;

const int LIMIT_TYPE_1 = 26;
const int LIMIT_TYPE_2 = 6000;

const int TOTAL_LIMIT = LIMIT_TYPE_1 + LIMIT_TYPE_2;

static long long queries = 0;
static long long cnt1 = 0;
static long long cnt2 = 0;
static long long query_limit = TOTAL_LIMIT;

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

    string s = inf.readToken();
    int n = (int)s.length();

    cout << n << endl;

    log_metrics();

    while (true) {

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

        string token;

        if (!(cin >> token)) {
            finish(_wa, "Unexpected EOF (no answer submitted)");
        }

        if (!token.empty() && token[0] == '!') {
            string guess;
            if (token == "!") {

                if (!(cin >> guess)) {
                    finish(_wa, "EOF after '!'");
                }
            } else {

                guess = token.substr(1);
            }

            if (guess == s) {
                finish(_ok, "Correct string restored");
            } else {
                finish(_wa, ("Incorrect answer. Expected: " + s + ", Found: " + guess).c_str());
            }
        }

        int type = -1;
        if (token == "?") {
            if (!(cin >> type)) {
                finish(_wa, "EOF after '?'");
            }
        } else {
            try {
                size_t pos;
                type = stoi(token, &pos);
                if (pos != token.size()) {
                     finish(_pe, ("Invalid token (garbage): " + token).c_str());
                }
            } catch (...) {
                finish(_pe, ("Invalid token (not a number): " + token).c_str());
            }
        }

        if (type == 1) {
            int i;
            if (!(cin >> i)) finish(_wa, "EOF reading query 1 parameter");

            if (i < 1 || i > n) {
                finish(_pe, format("Query 1: index %d out of bounds [1, %d]", i, n).c_str());
            }

            cnt1++;
            queries++;

            if (cnt1 > LIMIT_TYPE_1) {
                finish(_wa, format("Too many queries of type 1 (%lld > %d)", cnt1, LIMIT_TYPE_1).c_str());
            }

            cout << s[i-1] << endl;

        } else if (type == 2) {
            int l, r;
            if (!(cin >> l >> r)) finish(_wa, "EOF reading query 2 parameters");

            if (l < 1 || l > n || r < 1 || r > n || l > r) {
                finish(_pe, format("Query 2: invalid range [%d, %d] for n=%d", l, r, n).c_str());
            }

            cnt2++;
            queries++;

            if (cnt2 > LIMIT_TYPE_2) {
                finish(_wa, format("Too many queries of type 2 (%lld > %d)", cnt2, LIMIT_TYPE_2).c_str());
            }

            int mask = 0;
            for (int k = l - 1; k < r; k++) {
                mask |= (1 << (s[k] - 'a'));
            }
            int distinct = __builtin_popcount(mask);

            cout << distinct << endl;

        } else {
            finish(_pe, format("Unknown query type: %d", type).c_str());
        }

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

    return 0;
}

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

using namespace std;

static const int MAX_Q1 = 26;
static const int MAX_Q2 = 6000;

static const int QUERY_LIMIT = MAX_Q1 + MAX_Q2;

static int q1_count = 0;
static int q2_count = 0;

static void log_metrics() {
    try {
        long long total_queries = (long long)q1_count + q2_count;

        if (q1_count > MAX_Q1 || q2_count > MAX_Q2) {
            if (total_queries <= QUERY_LIMIT) {
                total_queries = (long long)QUERY_LIMIT + 1;
            }
        }

        tout << "queries=" << total_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);

    string s;
    int n;

    string token = inf.readToken();
    if (token.empty()) {
        finish(_fail, "Input file is empty");
    }

    bool is_number = true;
    for (char c : token) {
        if (!isdigit(c)) {
            is_number = false;
            break;
        }
    }

    if (is_number) {

        n = stoi(token);

        mt19937 rng(n * 239017 + 777);
        s.resize(n);

        if (n < 26) {

            for (int i = 0; i < n; ++i) {
                s[i] = 'a' + (rng() % 26);
            }
        } else {

            vector<char> chars(26);
            iota(chars.begin(), chars.end(), 'a');
            shuffle(chars.begin(), chars.end(), rng);

            for (int i = 0; i < 26; ++i) s[i] = chars[i];

            for (int i = 26; i < n; ++i) s[i] = 'a' + (rng() % 26);

            shuffle(s.begin(), s.end(), rng);
        }
    } else {

        s = token;
        n = s.size();
    }

    cout << n << endl;

    log_metrics();

    int hard_cap = 200000;

    while (true) {
        string typeStr;

        if (!(cin >> typeStr)) {

            finish(_wa, "Unexpected EOF (expected '?' or '!')");
        }

        if (typeStr == "!") {
            string ans;
            if (!(cin >> ans)) {
                finish(_pe, "Expected answer string after '!'");
            }

            if (ans == s) {
                finish(_ok, "Correct");
            } else {
                finish(_wa, "Wrong answer: expected " + s + ", got " + ans);
            }
        } else if (typeStr == "?") {

            if (q1_count + q2_count > hard_cap) {
                finish(_pe, "Hard query limit exceeded");
            }

            int type;
            if (!(cin >> type)) finish(_pe, "Expected query type (1 or 2) after '?'");

            if (type == 1) {
                int i;
                if (!(cin >> i)) finish(_pe, "Expected index i for query 1");
                if (i < 1 || i > n) finish(_pe, "Index out of bounds");

                q1_count++;
                cout << s[i-1] << endl;
            } else if (type == 2) {
                int l, r;
                if (!(cin >> l >> r)) finish(_pe, "Expected l r for query 2");
                if (l < 1 || r > n || l > r) finish(_pe, "Invalid range [l, r]");

                q2_count++;

                int mask = 0;
                for (int k = l - 1; k < r; ++k) {
                    mask |= (1 << (s[k] - 'a'));
                }
                cout << __builtin_popcount(mask) << endl;
            } else {
                finish(_pe, "Unknown query type: " + to_string(type));
            }

            if ((q1_count + q2_count) % 50 == 0) {
                log_metrics();
            }
        } else {
            finish(_pe, "Protocol error: expected '?' or '!', got '" + typeStr + "'");
        }
    }

    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_arg = opt<int>("n", -1);

    long long seed_val = -1;

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

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

        if (seed_val == 1) n = 1;
        else if (seed_val == 2) n = 26;
        else if (seed_val == 3) n = 1000;
        else if (seed_val == 4) n = 1000;
        else if (seed_val > 0 && seed_val <= 10) n = rnd.next(1, 100);
        else n = rnd.next(900, 1000);
    }

    string s = "";

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

        for (int i = 0; i < 26; ++i) s += (char)('a' + i);
    } else if (seed_val == 3) {

        s = string(n, 'a');
    } else if (seed_val == 4) {

        for (int i = 0; i < n; ++i) s += (i % 2 == 0 ? 'a' : 'b');
    } else {

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

            for (int i = 0; i < n; ++i) s += (char)('a' + rnd.next(26));
        } else if (type == 1) {

            vector<char> p(26);
            iota(p.begin(), p.end(), 'a');
            shuffle(p.begin(), p.end());
            for (int i = 0; i < n; ++i) {
                int idx = 0;

                while (idx < 25 && rnd.next(3) == 0) idx++;
                s += p[idx];
            }
        } else if (type == 2) {

            while ((int)s.size() < n) {
                char c = (char)('a' + rnd.next(26));
                int len = rnd.next(1, 50);
                for (int k = 0; k < len && (int)s.size() < n; ++k) s += c;
            }
        } else if (type == 3) {

            vector<char> p(26);
            iota(p.begin(), p.end(), 'a');
            shuffle(p.begin(), p.end());
            for (char c : p) s += c;
            while ((int)s.size() < n) s += p[rnd.next(26)];
            shuffle(s.begin(), s.end());
        } else {

            int period = rnd.next(1, 20);
            string pat = "";
            for(int k=0; k<period; ++k) pat += (char)('a' + rnd.next(26));
            for(int i=0; i < n; ++i) s += pat[i % period];
        }
    }

    if ((int)s.size() > n) s.resize(n);
    while ((int)s.size() < n) s += (char)('a' + rnd.next(26));

    if (mode == "non") {

        cout << s << endl;
    } else if (mode == "adp") {

        cout << n << endl;
    } else {
        quitf(_fail, "Unknown mode: %s", mode.c_str());
    }

    return 0;
}


It is an interactive problem.

Vasya enjoys solving quizzes. He found a strange device and wants to know how it works.

This device encrypted with the tree (connected undirected graph without cycles) with $n$ vertices, numbered with integers from $1$ to $n$. To solve this quiz you should guess this tree.

Fortunately, this device can make one operation, using which you should guess the cipher. You can give the device an array $d_1, d_2, \ldots, d_n$ of non-negative integers. On the device, there are $n$ lamps, $i$-th of them is connected with $i$-th vertex of the tree. For all $i$ the light will turn on the $i$-th lamp, if there exist such vertex of the tree with number $j \neq i$ that $dist(i, j) \leq d_j$. Let's define $dist(i, j)$ as the distance between vertices $i$ and $j$ in tree or number of edges on the simple path between vertices $i$ and $j$.

Vasya wants to solve this quiz using $\leq 80$ operations with the device and guess the tree. Help him!

Interaction

In the beginning, your program should read one integer $n$ — the number of vertices of the tree which encrypts the device ($2 \leq n \leq 1000$).

After that, you can make several operations in the following format. To do operation print a symbol"?" (without quotes) and $n$ integers $d_1, d_2, \ldots, d_n$, separated by spaces after it. Please note, that for all $i$ you can only use the numbers, satisfying the inequality $0 \leq d_i < n$. After that, you should read a string $s$ with length $n$, consisting of symbols "0" and "1" (without quotes). For all $i$ the symbol $s_i$ is equal to "0", if the lamp on the device, connected with $i$-th vertex of the tree is switched off and "1" otherwise.

After several operations, you should print guessed tree. To do it print the only symbol "!" (without quotes). In the next $n-1$ lines print $2$ integers $a_i$, $b_i$ — indexes of the vertices connected by $i$-th edge of the tree. This numbers should satisfy the conditions $1 \leq a_i, b_i \leq n$ and $a_i \neq b_i$. This edges should form a tree, which is equal to the hidden tree. After that, your program should terminate.

It is guaranteed, that in each test the tree is fixed before and won't change depending on your program's operations.

Your program can make from $0$ to $80$ operations with the device and after that guess the tree equal with the hidden.

If your program will make more than $80$ operations it can get any verdict, because it will continue reading from closed input. If your program will make operation or print the answer in the incorrect format, it can get any verdict too. Be careful.

Don't forget to flush the output after printing questions and answers.

To flush the output, you can use:

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

Example

Input

```
5
00000
11011
11100
10010
```

Output

```
? 0 0 0 0 0
? 1 1 2 0 2
? 0 0 0 1 0
? 0 1 0 0 1
!
4 2
1 5
3 4
4 1
```

Note

It is a picture of the tree which encrypt the device from the first test:

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

It is a table of pairwise distances between vertices in this tree:

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

* If you make operation where $d = [0, 0, 0, 0, 0]$, no lamp will switch on, because $dist(i, j) > 0$ for all $i \neq j$.
* If you make operation where $d = [1, 1, 2, 0, 2]$, all lamps except the lamp connected with the $3$-rd vertex will switch on. For example, lamp connected with the $1$-st vertex will switch on, because $dist(1, 5) = 1 \leq 2 = d_5$.
* If you make operation where $d = [0, 0, 0, 1, 0]$, all lamps except lamps connected with the $4$-th and $5$-th vertices will switch on.
* If you make operation where $d = [0, 1, 0, 0, 1]$, only lamps connected with the $1$-st and $4$-th vertices will switch on.

#include "testlib.h"
#include <algorithm>
#include <csignal>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;

static int queries = 0;
static long long query_limit = -1;

void log_queries() {
    tout << "queries=" << queries << "\n";
    tout << "query_limit=" << query_limit << "\n";
}

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

int main(int argc, char* argv[]) {
    registerInteraction(argc, argv);
    signal(SIGPIPE, SIG_IGN);
    atexit(log_queries);

    const int n = inf.readInt();
    vector<vector<int>> g(n + 1);
    set<pair<int, int>> edges;
    if (inf.seekEof()) {

        for (int u = 1; u + 1 <= n; u++) {
            int v = u + 1;
            g[u].push_back(v);
            g[v].push_back(u);
            edges.insert({u, v});
        }
    } else {
        for (int i = 0; i < n - 1; i++) {
            int u = inf.readInt();
            int v = inf.readInt();
            g[u].push_back(v);
            g[v].push_back(u);
            if (u > v) {
                swap(u, v);
            }
            edges.insert({u, v});
        }
    }

    vector<vector<short>> dist(n + 1, vector<short>(n + 1, -1));
    for (int s = 1; s <= n; s++) {
        queue<int> q;
        dist[s][s] = 0;
        q.push(s);
        while (!q.empty()) {
            int u = q.front();
            q.pop();
            for (int v : g[u]) {
                if (dist[s][v] != -1) {
                    continue;
                }
                dist[s][v] = short(dist[s][u] + 1);
                q.push(v);
            }
        }
    }

    query_limit = 80;

    cout << n << "\n" << flush;

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

        if (cmd == "?") {
            queries++;
            if (queries > query_limit) {
                quit_with(_pe, "Too many operations");
            }

            vector<int> d(n + 1);
            for (int i = 1; i <= n; i++) {
                if (!(cin >> d[i])) {
                    quit_with(_pe, "Invalid query payload");
                }
                if (d[i] < 0 || d[i] >= n) {
                    quit_with(_pe, "d[i] out of range");
                }
            }

            string s(n, '0');
            for (int i = 1; i <= n; i++) {
                bool on = false;
                for (int j = 1; j <= n; j++) {
                    if (i == j) {
                        continue;
                    }
                    if (dist[i][j] <= d[j]) {
                        on = true;
                        break;
                    }
                }
                s[i - 1] = on ? '1' : '0';
            }
            cout << s << "\n" << flush;

        } else if (cmd == "!") {
            set<pair<int, int>> out;
            for (int i = 0; i < n - 1; i++) {
                int u, v;
                if (!(cin >> u >> v)) {
                    quit_with(_pe, "Missing edges");
                }
                if (!(1 <= u && u <= n && 1 <= v && v <= n && u != v)) {
                    quit_with(_pe, "Invalid edge");
                }
                if (u > v) {
                    swap(u, v);
                }
                out.insert({u, v});
            }
            if (out == edges) {
                quit_with(_ok, "Correct");
            }
            quit_with(_wa, "Wrong tree");

        } else {
            quit_with(_pe, "Unknown command: " + cmd);
        }
    }
}

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

static vector<pair<int, int>> gen_path(int n) {
    vector<pair<int, int>> e;
    for (int i = 1; i + 1 <= n; i++) e.push_back({i, i + 1});
    return e;
}

static vector<pair<int, int>> gen_star(int n) {
    vector<pair<int, int>> e;
    for (int i = 2; i <= n; i++) e.push_back({1, i});
    return e;
}

static vector<pair<int, int>> gen_balanced(int n) {
    vector<pair<int, int>> e;
    for (int i = 2; i <= n; i++) e.push_back({i / 2, i});
    return e;
}

static vector<pair<int, int>> gen_random(int n) {
    vector<pair<int, int>> e;
    e.reserve(n - 1);
    for (int i = 2; i <= n; i++) {
        int p = rnd.next(1, i - 1);
        e.push_back({p, i});
    }
    return e;
}

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

    const long long seed = (argc >= 2) ? atoll(argv[1]) : 1;

    int n = 1000;
    if (seed == 1) n = 2;
    else if (seed == 2) n = 3;
    else if (seed <= 10) n = 50 + (int)seed * 10;
    n = max(2, min(1000, n));

    vector<pair<int, int>> edges;
    int kind = (int)(seed % 4);
    if (kind == 0) edges = gen_path(n);
    else if (kind == 1) edges = gen_star(n);
    else if (kind == 2) edges = gen_balanced(n);
    else edges = gen_random(n);

    cout << n << "\n";
    for (auto [u, v] : edges) cout << u << " " << v << "\n";
    return 0;
}


This is an interactive problem.

I want to play a game with you...

We hid from you a cyclic graph of $n$ vertices ($3 \le n \le 10^{18}$). A cyclic graph is an undirected graph of $n$ vertices that form one cycle. Each vertex belongs to the cycle, i.e. the length of the cycle (the number of edges in it) is exactly $n$. The order of the vertices in the cycle is arbitrary.

You can make queries in the following way:

* "? a b" where $1 \le a, b \le 10^{18}$ and $a \neq b$. In response to the query, the interactor outputs on a separate line the length of random of two paths from vertex $a$ to vertex $b$, or -1 if $\max(a, b) > n$. The interactor chooses one of the two paths with equal probability. The length of the path —is the number of edges in it.

You win if you guess the number of vertices in the hidden graph (number $n$) by making no more than $50$ queries.

Note that the interactor is implemented in such a way that for any ordered pair $(a, b)$, it always returns the same value for query "? a b", no matter how many such queries. Note that the "? b a" query may be answered differently by the interactor.

The vertices in the graph are randomly placed, and their positions are fixed in advance.

The number of tests the jury has is $50$.

Interaction

You can make no more than $50$ of queries. To make a query, output on a separate line:

* "? a b", where $1 \le a, b \le 10^{18}$ and $a \neq b$. In response to the query, the interactor will output on a separate line the length of a random simple path from vertex $a$ to vertex $b$ (not to be confused with the path from $b$ to $a$), or $-1$ if $\max(a, b) > n$. The interactor chooses one of the two paths with equal probability.

If your program gets a number 0 as a result of a query, it means that the verdict for your solution is already defined as "wrong answer" (for example, you made more than $50$ queries or made an invalid query). In this case, your program should terminate immediately. Otherwise, in this scenario you may get a random verdict "Execution error", "Exceeded time limit" or some other verdict instead of "Wrong answer".

The answer, like queries, print on a separate line. The output of the answer is not counted as a query when counting them. To print it, use the following format:

* "! n": the expected size of the hidden graph ($3 \le n \le 10^{18}$).

After that, your program should terminate.

After the output of the next query, be sure to use stream cleaning functions so that some of your output is not left in some buffer. For example, in C++ you should use function flush(stdout), in Java call System.out.flush(), in Pascal flush(output) and stdout.flush() for Python.

Note that the interactor is implemented in such a way that for any ordered pair $(a, b)$, it always returns the same value for query "? a b", no matter how many such queries. Note that the "? b a" query may be answered differently by the interactor.

The vertices in the graph are randomly placed, and their positions are fixed in advance.

The number of tests the jury has is $50$.

Example

Input

```
1

2

-1
```

Output

```
? 1 2

? 1 3

? 1 4

! 3
```

Note

In the first example, the graph could look like this

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

The lengths of the simple paths between all pairs of vertices in this case are $1$ or $2$.

* The first query finds out that one of the simple paths from vertex $1$ to vertex $2$ has a length of $1$.
* With the second query, we find out that one of the simple paths from vertex $1$ to vertex $3$ has length $2$.
* In the third query, we find out that vertex $4$ is not in the graph. Consequently, the size of the graph is $3$.

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

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

static const long long HARD_CAP = 2000;

static long long hidden_n = -1;
static long long seed_val = 0;

static vector<int> small_perm;
static bool use_small_perm = false;

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 uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
}

static long long get_pos(long long u) {
    if (use_small_perm) {

        if (u < 1 || u > hidden_n) return 0;
        return small_perm[u - 1];
    } else {

        uint64_t h = splitmix64((uint64_t)u ^ (uint64_t)seed_val);
        return h % hidden_n;
    }
}

static int get_path_choice(long long u, long long v) {

    uint64_t h = splitmix64((uint64_t)u + 0x9e3779b97f4a7c15 + ((uint64_t)v << 6) + ((uint64_t)v >> 2));

    h = splitmix64(h ^ (uint64_t)seed_val);
    return h % 2;
}

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

    string mode = inf.readToken();
    if (mode == "FIXED") {
        hidden_n = inf.readLong();
        seed_val = inf.readLong();
    } else if (mode == "ADAPTIVE") {
        long long min_n = inf.readLong();
        long long max_n = inf.readLong();
        seed_val = inf.readLong();

        mt19937_64 rng(seed_val);
        hidden_n = min_n + (rng() % (max_n - min_n + 1));
    } else {
        finish(_fail, "Unknown generator mode: " + mode);
    }

    if (hidden_n <= 1000000) {

        use_small_perm = true;
        small_perm.resize(hidden_n);
        iota(small_perm.begin(), small_perm.end(), 0);
        mt19937_64 rng(seed_val);
        shuffle(small_perm.begin(), small_perm.end(), rng);
    } else {

        use_small_perm = false;
    }

    log_metrics();

    while (true) {

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

        string token;
        if (!(cin >> token)) {
            finish(_pe, "Unexpected EOF (expected '?' or '!')");
        }

        if (token == "!") {

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

            if (ans == hidden_n) {
                finish(_ok, "Guessed correct n=" + to_string(hidden_n));
            } else {
                finish(_wa, "Guessed n=" + to_string(ans) + ", expected n=" + to_string(hidden_n));
            }
        } else {

            long long a, b;

            if (token == "?") {
                if (!(cin >> a >> b)) finish(_pe, "Expected two numbers after '?'");
            } else {
                try {
                    a = stoll(token);
                } catch (...) {
                    finish(_pe, "Invalid token '" + token + "' (expected '?' or number)");
                }
                if (!(cin >> b)) finish(_pe, "Expected second number for query");
            }

            queries++;

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

            if (a < 1 || b < 1 || a > 1000000000000000000LL || b > 1000000000000000000LL) {
                finish(_wa, "Query parameters out of bounds [1, 10^18]");
            }
            if (a == b) {
                finish(_wa, "Invalid query: a == b");
            }

            long long response = -1;
            if (a > hidden_n || b > hidden_n) {
                response = -1;
            } else {
                long long pa = get_pos(a);
                long long pb = get_pos(b);
                long long dist = abs(pa - pb);

                long long paths[2] = {dist, hidden_n - dist};

                int choice = get_path_choice(a, b);
                response = paths[choice];
            }

            cout << response << endl;
        }
    }

    return 0;
}

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

static long long queries = 0;
static const long long query_limit = 50;
static const long long hard_cap = 500;

static long long hidden_n = 0;
static long long seed_val = 0;

static const long long SMALL_N_THRESHOLD = 200000;
static vector<long long> small_perm;
static map<long long, long long> large_pos;
static set<long long> used_vals;

static map<pair<long long, long long>, long long> memo_ans;

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

long long get_position(long long u) {

    if (u < 1 || u > hidden_n) return -1;

    if (hidden_n <= SMALL_N_THRESHOLD) {
        return small_perm[u - 1];
    } else {
        if (large_pos.count(u)) {
            return large_pos[u];
        }

        long long p;
        int tries = 0;
        do {
            p = rnd.next(0LL, hidden_n - 1);
            tries++;
            if (tries > 1000) {

                break;
            }
        } while (used_vals.count(p));

        used_vals.insert(p);
        large_pos[u] = p;
        return p;
    }
}

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

    string mode = inf.readToken();
    if (mode == "ADAPTIVE") {
        long long min_n = inf.readLong();
        long long max_n = inf.readLong();
        seed_val = inf.readLong();

        rnd.setSeed(seed_val);
        hidden_n = rnd.next(min_n, max_n);
    } else {

        hidden_n = inf.readLong();
        seed_val = inf.readLong();

        rnd.setSeed(seed_val);
    }

    if (hidden_n <= SMALL_N_THRESHOLD) {
        small_perm.resize(hidden_n);
        iota(small_perm.begin(), small_perm.end(), 0);
        shuffle(small_perm.begin(), small_perm.end());
    }

    log_metrics();

    while (true) {
        string token;

        if (!(cin >> token)) {

            finish(_pe, "Unexpected EOF (did not receive answer)");
        }

        if (token == "!") {

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

            if (guess == hidden_n) {
                finish(_ok, format("Correct! n=%lld", hidden_n));
            } else {
                finish(_wa, format("Wrong answer. Expected %lld, got %lld", hidden_n, guess));
            }

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

            queries++;
            if (queries > hard_cap) {
                finish(_pe, "Hard query limit exceeded (potential infinite loop)");
            }

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

            long long a, b;
            if (!(cin >> a >> b)) {
                finish(_pe, "Expected two integers after '?'");
            }

            if (a < 1 || a > 1000000000000000000LL || b < 1 || b > 1000000000000000000LL) {
                finish(_pe, "Query arguments out of bounds [1, 10^18]");
            }
            if (a == b) {
                finish(_pe, "Query arguments must be distinct");
            }

            long long ans = -1;
            if (a > hidden_n || b > hidden_n) {
                ans = -1;
            } else {

                if (memo_ans.count({a, b})) {
                    ans = memo_ans[{a, b}];
                } else {

                    long long p_a = get_position(a);
                    long long p_b = get_position(b);
                    long long dist = abs(p_a - p_b);

                    long long path1 = dist;
                    long long path2 = hidden_n - dist;

                    if (rnd.next(0, 1) == 0) {
                        ans = path1;
                    } else {
                        ans = path2;
                    }

                    memo_ans[{a, b}] = ans;
                }
            }

            cout << ans << endl;

        } else {
            finish(_pe, format("Invalid token '%s'", token.c_str()));
        }
    }

    return 0;
}


This is an interactive problem.

Yui is a girl who enjoys playing Mahjong.

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

She has a mysterious set which consists of tiles (this set can be empty). Each tile has an integer value between $1$ and $n$, and at most $n$ tiles in the set have the same value. So the set can contain at most $n^2$ tiles.

You want to figure out which values are on the tiles. But Yui is shy, she prefers to play a guessing game with you.

Let's call a set consisting of three tiles triplet if their values are the same. For example, $\{2,\,2,\,2\}$ is a triplet, but $\{2,\,3,\,3\}$ is not.

Let's call a set consisting of three tiles straight if their values are consecutive integers. For example, $\{2,\,3,\,4\}$ is a straight, but $\{1,\,3,\,5\}$ is not.

At first, Yui gives you the number of triplet subsets and straight subsets of the initial set respectively. After that, you can insert a tile with an integer value between $1$ and $n$ into the set at most $n$ times. Every time you insert a tile, you will get the number of triplet subsets and straight subsets of the current set as well.

Note that two tiles with the same value are treated different. In other words, in the set $\{1,\,1,\,2,\,2,\,3\}$ you can find $4$ subsets $\{1,\,2,\,3\}$.

Try to guess the number of tiles in the initial set with value $i$ for all integers $i$ from $1$ to $n$.

Input

The first line contains a single integer $n$ ($4 \le n \le 100$).

The second line contains two integers which represent the number of triplet subsets and straight subsets of the initial set respectively.

Output

When you are ready to answer, print a single line of form "! $a_1$ $a_2$ $\ldots$ $a_n$" ($0 \le a_i \le n$), where $a_i$ is equal to the number of tiles in the initial set with value $i$.

Interaction

To insert a tile, print a single line of form "+ $x$" ($1 \le x \le n$), where $x$ is the value of the tile you insert. Then you should read two integers which represent the number of triplet subsets and straight subsets of the current set respectively.

After printing a line, do not forget to 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.

You will get Wrong answer if you insert more than $n$ tiles.

Example

Input

```
5
1 6
2 9
5 12
5 24
6 24
```

Output

```
+ 1
+ 1
+ 2
+ 5
! 2 1 3 0 2
```

Note

In the first test, the initial set of tiles is $\{1, 1, 2, 3, 3, 3, 5, 5\}$. It has only one triplet subset $\{3, 3, 3\}$ and six straight subsets, all equal to $\{1, 2, 3\}$. After inserting a tile with value $1$ the set of tiles will be $\{1, 1, 1, 2, 3, 3, 3, 5, 5\}$ and will have two triplet subsets $\{1, 1, 1\}$, $\{3, 3, 3\}$ and nine straight subsets, all equal to $\{1, 2, 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 << 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 bool parseLL(const string& s, long long& out) {
    if (s.empty()) return false;
    int i = 0;
    if (s[0] == '-') {
        i = 1;
        if (i == (int)s.size()) return false;
    } else if (s[0] == '+') {
        return false;
    }
    for (; i < (int)s.size(); i++) {
        if (!isdigit((unsigned char)s[i])) return false;
    }
    try {
        out = stoll(s);
    } catch (...) {
        return false;
    }
    return true;
}

static long long comb3(long long c) {
    if (c < 3) return 0;
    return c * (c - 1) * (c - 2) / 6;
}

static pair<long long, long long> computeCounts(const vector<long long>& c) {
    int n = (int)c.size() - 1;
    long long triplets = 0;
    long long straights = 0;
    for (int i = 1; i <= n; i++) triplets += comb3(c[i]);
    for (int i = 1; i + 2 <= n; i++) straights += c[i] * c[i + 1] * c[i + 2];
    return {triplets, straights};
}

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

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

    int n = inf.readInt(4, 100, "n");
    vector<long long> initial(n + 1, 0), cur(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        int ai = inf.readInt(0, n, ("a" + to_string(i)).c_str());
        initial[i] = ai;
        cur[i] = ai;
    }

    query_limit = n;
    log_metrics();

    auto [t0, s0] = computeCounts(cur);

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

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

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

        if (cmd == "+") {
            string xs;
            if (!readToken(xs)) finish(_pe, "Missing x after '+'");
            long long xll;
            if (!parseLL(xs, xll)) finish(_pe, "Non-integer x after '+'");
            if (xll < 1 || xll > n) finish(_pe, "x out of range");
            queries++;
            if (queries > hard_cap) finish(_pe, "Hard cap exceeded");

            int x = (int)xll;
            cur[x]++;

            auto [t, s] = computeCounts(cur);
            cout << t << " " << s << "\n";
            cout.flush();
        } else if (cmd == "!") {
            vector<long long> ans(n + 1, 0);
            for (int i = 1; i <= n; i++) {
                string ts;
                if (!readToken(ts)) finish(_pe, "Missing ai in final answer");
                long long v;
                if (!parseLL(ts, v)) finish(_pe, "Non-integer ai in final answer");
                if (v < 0 || v > n) finish(_pe, "ai out of range in final answer");
                ans[i] = v;
            }
            for (int i = 1; i <= n; i++) {
                if (ans[i] != initial[i]) {
                    finish(_wa, "Wrong final answer");
                }
            }
            finish(_ok, "OK");
        } else {
            finish(_pe, "Invalid command token");
        }
    }
}

#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 inline string trim_copy(const string& s) {
    size_t l = 0, r = s.size();
    while (l < r && isspace((unsigned char)s[l])) l++;
    while (r > l && isspace((unsigned char)s[r - 1])) r--;
    return s.substr(l, r - l);
}

static long long c3(long long x) {
    if (x < 3) return 0;
    return x * (x - 1) * (x - 2) / 6;
}

static pair<long long, long long> computeTS(const vector<long long>& cnt, int n) {
    long long T = 0, S = 0;
    for (int i = 1; i <= n; i++) T += c3(cnt[i]);
    for (int i = 1; i + 2 <= n; i++) S += cnt[i] * cnt[i + 1] * cnt[i + 2];
    return {T, S};
}

static vector<int> build_deterministic_counts(int n) {
    vector<int> a(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        long long v = (1LL * i * i * 37 + 17LL * i + 23) % (n + 1);
        if (i % 10 == 0) v = n;
        if (i % 7 == 0) v = max<long long>(v, n / 2);
        a[i] = (int)v;
    }
    return a;
}

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

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

    int n = inf.readInt(4, 100);

    vector<int> initial(n + 1, 0);
    bool hasCounts = !inf.seekEof();
    if (hasCounts) {
        for (int i = 1; i <= n; i++) initial[i] = inf.readInt(0, n);
    } else {
        initial = build_deterministic_counts(n);
    }

    vector<long long> cur(n + 1, 0);
    for (int i = 1; i <= n; i++) cur[i] = initial[i];

    query_limit = n;

    log_metrics();

    auto ts0 = computeTS(cur, n);
    cout << n << "\n";
    cout << ts0.first << " " << ts0.second << "\n";
    cout.flush();

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

    while (true) {
        string line;
        if (!std::getline(cin, line)) {
            finish(_pe, "EOF from contestant");
        }
        line = trim_copy(line);
        if (line.empty()) continue;

        char c = line[0];
        if (c == '+') {
            queries++;
            if (queries > hard_cap) finish(_pe, "too many queries (hard cap exceeded)");

            string rest = trim_copy(line.substr(1));
            if (rest.empty()) finish(_pe, "missing x after '+'");

            stringstream ss(rest);
            string tok;
            ss >> tok;
            if (tok.empty()) finish(_pe, "missing x after '+'");
            string extra;
            ss >> extra;
            if (!extra.empty()) finish(_pe, "extra tokens after '+ x'");

            long long xll = 0;
            if (!parse_single_ll(tok, xll)) finish(_pe, "bad integer x after '+'");
            if (xll < 1 || xll > n) finish(_pe, "x out of range after '+'");

            int x = (int)xll;
            cur[x]++;

            auto ts = computeTS(cur, n);
            cout << ts.first << " " << ts.second << "\n";
            cout.flush();
            continue;
        }

        if (c == '!') {
            string rest = trim_copy(line.substr(1));
            vector<long long> ans(n + 1, 0);

            stringstream ss(rest);
            for (int i = 1; i <= n; i++) {
                string tok;
                if (!(ss >> tok)) finish(_pe, "not enough numbers after '!'");
                long long v = 0;
                if (!parse_single_ll(tok, v)) finish(_pe, "bad integer in answer");
                if (v < 0 || v > n) finish(_pe, "answer value out of range");
                ans[i] = v;
            }
            string extra;
            if (ss >> extra) finish(_pe, "too many tokens after answer");

            for (int i = 1; i <= n; i++) {
                if (ans[i] != initial[i]) finish(_wa, "wrong initial multiplicities");
            }
            finish(_ok, "correct");
        }

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

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

static vector<int> makeCounts(int n, long long seed) {
    vector<int> a(n + 1, 0);

    if (seed == 1) {

        return a;
    }
    if (seed == 2) {

        for (int i = 1; i <= n; i++) a[i] = n;
        return a;
    }
    if (seed == 3) {

        for (int i = 1; i <= n; i++) {
            int r = i % 3;
            if (r == 1) a[i] = 1;
            else if (r == 2) a[i] = 0;
            else a[i] = min(2, n);
        }
        if (n >= 3) {
            a[1] = n;
            a[2] = n;
            a[3] = n;
        }
        int mid = (n + 1) / 2;
        for (int d = -2; d <= 2; d++) {
            int idx = mid + d;
            if (1 <= idx && idx <= n) a[idx] = n;
        }
        int tail = n - 2;
        if (tail >= 1) a[tail] = n;
        if (tail + 1 >= 1 && tail + 1 <= n) a[tail + 1] = n;
        if (tail + 2 >= 1 && tail + 2 <= n) a[tail + 2] = n;
        return a;
    }

    for (int i = 1; i <= n; i++) {
        int coin = rnd.next(0, 99);
        if (coin < 55) {
            a[i] = rnd.next(0, 1);
        } else if (coin < 70) {
            a[i] = rnd.next(0, min(n, 3));
        } else if (coin < 85) {
            int lo = n / 3, hi = (2 * n) / 3;
            if (lo > hi) lo = 0, hi = n;
            a[i] = rnd.next(lo, hi);
        } else {
            a[i] = n;
        }
    }

    int minL = max(3, n / 2);
    int L = rnd.next(minL, n);
    int start = rnd.next(1, n - L + 1);
    for (int i = start; i < start + L; i++) {
        int v = rnd.next(max(0, n - 8), n);
        a[i] = v;
    }

    int blocks = rnd.next(3, 8);
    for (int b = 0; b < blocks; b++) {
        int len = rnd.next(1, min(7, n));
        int st = rnd.next(1, n - len + 1);
        int base = rnd.next(max(0, n - 12), n);
        for (int i = st; i < st + len; i++) {
            int v = base + rnd.next(-2, 2);
            v = max(0, min(n, v));
            a[i] = max(a[i], v);
        }
    }

    if (n >= 4) {
        a[1] = max(a[1], rnd.next(0, n));
        a[2] = max(a[2], rnd.next(0, n));
        a[n - 1] = max(a[n - 1], rnd.next(0, n));
        a[n] = max(a[n], rnd.next(0, n));
    }

    for (int i = 1; i <= n; i++) a[i] = max(0, min(n, a[i]));
    return a;
}

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

    string mode = opt<string>("mode", "non");
    int n = opt<int>("n", 100);
    n = max(4, min(100, n));

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

    if (mode == "adp") {

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

    vector<int> a = makeCounts(n, seed);

    cout << n << "\n";
    for (int i = 1; i <= n; i++) {
        if (i > 1) cout << ' ';
        cout << a[i];
    }
    cout << "\n";
    return 0;
}


This is an interactive problem.

Fox gave Cat two positive integers $n$ and $k$. She has a hidden array $a_1, \ldots , a_n$ of length $n$, such that $1 \leq a_i \leq n$ for every $i$. Now they are going to play the following game:

For any two integers $l, r$ such that $1 \leq l \leq r \leq n$, define $f(l, r) = (r - l + 1) \cdot \max\limits_{x=l}^r a_x$. In other words, $f(l, r)$ is equal to the maximum of the subarray $a_l, \ldots, a_r$ multiplied by its size.

Cat can ask Fox at most $2 n$ questions about the array. He will tell her two integers $l$ and $x$ ($1 \leq l \leq n, 1 \leq x \leq 10^9$), and she will tell him one integer $p$ as the answer — the smallest positive integer $r$ such that $f(l, r) = x$, or $n+1$ if no such $r$ exists.

Now, Cat needs to find the largest value $m$ such that there exists a sequence $c_1, \ldots, c_{k-1}$ such that $1 \leq c_1 < \ldots < c_{k-1} < n$ and $f(1, c_1) = f(c_1 + 1, c_2) = \ldots = f(c_{k-1}+1, n) = m$. If no such $m$ exists, he should indicate this and take $-1$ as the answer. Note that for $k = 1$, $m$ is always equal to $f(1, n)$.

In other words, the goal is to find the largest $m$ such that you can split the array into exactly $k$ subarrays ($k$ is the constant given to you in the beginning of the interaction) so that all the subarrays have the product of their length and their maximum equal to $m$, or determine that no such $m$ exists. Every element should belong in exactly one of the subarrays.

Cat doesn't know what he should do, so he asked you to play the game for him.

Interaction

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

The first line of each test case contains two positive integers $n$ and $k$ ($1 \leq k \leq n \leq 10^4$) — the length of the hidden array and the number of subarrays in the desired split.

Now you are allowed to make queries in the following way — print one line of the form "$\mathtt{?} \ l \ x$" (it must hold that $1 \leq l \leq n$, $1 \leq x \leq 10^9$) and you will receive the smallest integer $r$ such that $l \leq r \leq n$ and $f(l, r) = x$, or $n + 1$ if no such $r$ exists.

If you want to print the answer, output "$\mathtt{!} \ m$" and you will recieve $1$ if your answer is correct and $-1$ otherwise. In the first case, the interaction continues with the next test case. Note that printing the answer doesn't count towards the number of queries made. Please note that you don't receive the values for the next test case immediately, you will first have to read whether your answer to the last test case was correct.

If you receive the integer $-1$ at any moment, it means your program has made an invalid query, exceeded the query limit, or gave an incorrect answer. Your program must terminate immediately to receive a 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 documentation for other languages.

It is guaranteed that the total sum of $n$ over the test cases won't exceed $10^4$.

Example

Input

```
3
1 1

1
2 2

1

3

1
6 3

7

2

3

6

1
```

Output

```
! 1

? 1 1

? 2 1

! -1

? 1 9

? 1 6

? 3 6

? 4 6

! 6
```

Note

The hidden arrays in the three testcases are $[1]$, $[1, 2]$ and $[1, 3, 6, 1, 2, 1]$. In the second testcase, no split satisfies the constraints, so the answer is $-1$.

The answer for the first query of the third testcase is $7$ since no valid $r$ exists. For the second query of the third testcase, since $2 \cdot \max(1, 3) = 6$, we will get $2$ as the answer, since $r = 1$ doesn't satisfy the constraint.

The sample interaction guessed all three answers ($1, -1$ and $6$) correctly, so it received $1$ after each answer.

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

struct CaseData {
    int n = 0, k = 0;
    vector<int> a;
    vector<int> lg;
    vector<vector<int>> st;
    long long answer = -1;

    void buildSparse() {
        lg.assign(n + 1, 0);
        for (int i = 2; i <= n; i++) lg[i] = lg[i / 2] + 1;
        int K = lg[n];
        st.assign(K + 1, vector<int>(n + 1, 0));
        for (int i = 1; i <= n; i++) st[0][i] = a[i];
        for (int j = 1; j <= K; j++) {
            int len = 1 << j;
            int half = len >> 1;
            for (int i = 1; i + len - 1 <= n; i++) {
                st[j][i] = max(st[j - 1][i], st[j - 1][i + half]);
            }
        }
    }

    int rangeMax(int l, int r) const {
        int len = r - l + 1;
        int j = lg[len];
        return max(st[j][l], st[j][r - (1 << j) + 1]);
    }

    long long f(int l, int r) const {
        long long mx = rangeMax(l, r);
        long long len = r - l + 1;
        return len * mx;
    }

    int findRForX(int l, long long x) const {
        if (l < 1 || l > n) return n + 1;
        if (x < 1) return n + 1;
        if (f(l, n) < x) return n + 1;
        int lo = l, hi = n, ans = n + 1;
        while (lo <= hi) {
            int mid = (lo + hi) >> 1;
            long long val = f(l, mid);
            if (val >= x) {
                ans = mid;
                hi = mid - 1;
            } else {
                lo = mid + 1;
            }
        }
        if (ans == n + 1) return n + 1;
        return (f(l, ans) == x) ? ans : (n + 1);
    }

    bool feasibleByScan(long long m) const {
        int pos = 1;
        for (int seg = 1; seg <= k; seg++) {
            int remainingElems = n - pos + 1;
            int remainingSegs = k - seg + 1;
            if (remainingElems < remainingSegs) return false;

            int curMax = 0;
            bool found = false;
            for (int r = pos; r <= n; r++) {
                curMax = max(curMax, a[r]);
                long long val = 1LL * (r - pos + 1) * curMax;
                if (val == m) {
                    pos = r + 1;
                    found = true;
                    break;
                }
                if (val > m) return false;
            }
            if (!found) return false;
        }
        return pos == n + 1;
    }

    long long computeAnswer() const {
        if (k == 1) return 1LL * n * (*max_element(a.begin() + 1, a.end()));

        vector<int> prefMax(n + 1, 0);
        for (int i = 1; i <= n; i++) prefMax[i] = max(prefMax[i - 1], a[i]);

        int maxFirstEnd = n - (k - 1);
        for (int r = maxFirstEnd; r >= 1; r--) {
            long long m = 1LL * r * prefMax[r];
            if (feasibleByScan(m)) return m;
        }
        return -1;
    }
};

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

    int t = 0;
    try {
        t = inf.readInt(1, 1000, "t");
    } catch (...) {
        finish(_pe, "Failed to read t from hidden input");
    }

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

    long long totalBudget = 0;
    for (int tc = 0; tc < t; tc++) {
        CaseData cs;
        cs.n = inf.readInt(1, 10000, "n");
        cs.k = inf.readInt(1, cs.n, "k");
        cs.a.assign(cs.n + 1, 0);
        for (int i = 1; i <= cs.n; i++) {
            cs.a[i] = inf.readInt(1, cs.n, "a[i]");
        }
        cs.buildSparse();
        cs.answer = cs.computeAnswer();
        cases.push_back(std::move(cs));
        totalBudget += 2LL * cases.back().n;
    }

    query_limit = totalBudget;
    log_metrics();

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

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

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

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

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

            if (cmd == "?") {
                long long l, x;
                if (!(cin >> l >> x)) {
                    cout << -1 << "\n";
                    cout.flush();
                    finish(_pe, "Malformed query");
                }
                if (l < 1 || l > cs.n || x < 1 || x > 1000000000LL) {
                    cout << -1 << "\n";
                    cout.flush();
                    finish(_wa, "Invalid query parameters");
                }

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

                int r = cs.findRForX((int)l, x);
                cout << r << "\n";
                cout.flush();
            } else if (cmd == "!") {
                long long m;
                if (!(cin >> m)) {
                    cout << -1 << "\n";
                    cout.flush();
                    finish(_pe, "Malformed answer");
                }

                if (m == cs.answer) {
                    cout << 1 << "\n";
                    cout.flush();
                    break;
                } else {
                    cout << -1 << "\n";
                    cout.flush();
                    finish(_wa, "Wrong answer");
                }
            } else {
                cout << -1 << "\n";
                cout.flush();
                finish(_pe, "Unknown command token");
            }
        }
    }

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

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

static vector<int> buildHardArray(long long seedVal, int n) {
    vector<int> a(n + 1, 1);

    if (seedVal == 1) {
        a.assign(2, 1);
        return a;
    }
    if (seedVal == 2) {
        a.assign(3, 1);
        a[1] = 1;
        a[2] = 2;
        return a;
    }
    if (seedVal == 3) {
        a.assign(7, 1);
        a[1] = 1;
        a[2] = 3;
        a[3] = 6;
        a[4] = 1;
        a[5] = 2;
        a[6] = 1;
        return a;
    }

    int type = rnd.next(1, 4);

    if (type == 1) {
        for (int i = 1; i <= n; i++) a[i] = i;
        return a;
    }

    if (type == 2) {
        int b = rnd.next(10, 200);
        int cur = rnd.next(1, min(n, 5));
        for (int i = 1; i <= n; i++) {
            if (i % b == 1 && i > 1) {
                int drop = rnd.next(0, max(0, b / 3));
                cur = max(1, cur - drop);
            }
            cur = min(n, cur + rnd.next(0, 2));
            a[i] = cur;
        }
        a[n] = n;
        int tailStart = max(1, n - 700);
        for (int i = tailStart; i <= n; i++) {
            a[i] = max(a[i], min(n, i - tailStart + 1));
        }
        for (int i = 1; i <= n; i++) a[i] = min(n, max(1, a[i]));
        a[n] = n;
        return a;
    }

    if (type == 3) {
        int period = rnd.next(15, 60);
        int spikeVal = rnd.next(1, max(2, n / period));
        for (int i = 1; i <= n; i++) {
            if (i % period == 0) {
                spikeVal = min(n, spikeVal + rnd.next(1, 5));
                a[i] = spikeVal;
            } else {
                int within = i % period;
                a[i] = min(n, within + rnd.next(0, 2));
            }
        }
        for (int i = 2; i <= n; i++) a[i] = max(a[i], a[i - 1]);
        a[n] = n;
        return a;
    }

    for (int i = 1; i <= n; i++) {
        int val = i;
        if (rnd.next(0, 9) == 0) val = max(1, i - rnd.next(1, min(200, i)));
        int rem = n - i;
        if (rem > 0 && rnd.next(0, 19) == 0) val = min(n, i + rnd.next(1, min(200, rem)));
        a[i] = min(n, max(1, val));
    }
    int pref = 0;
    for (int i = 1; i <= n; i++) {
        pref = max(pref, a[i]);
        if (i % 3 == 0 && pref < min(n, i)) {
            a[i] = max(a[i], min(n, i));
            pref = max(pref, a[i]);
        }
    }
    for (int i = 1; i <= n; i++) a[i] = min(n, max(1, a[i]));
    a[n] = n;
    return a;
}

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

    string mode = opt<string>("mode", "non");
    int nOpt = opt<int>("n", 10000);
    int kOpt = opt<int>("k", -1);

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

    int n, k;
    vector<int> a;

    if (seedVal == 1) {
        n = 1;
        k = 1;
        a = buildHardArray(seedVal, n);
    } else if (seedVal == 2) {
        n = 2;
        k = 2;
        a = buildHardArray(seedVal, n);
    } else if (seedVal == 3) {
        n = 6;
        k = 3;
        a = buildHardArray(seedVal, n);
    } else {
        n = nOpt;
        if (n < 1) n = 1;
        if (n > 10000) n = 10000;

        if (kOpt != -1) {
            k = kOpt;
        } else {
            int base = rnd.next(2, 8);
            k = max(1, n / base);
            k = min(k, n);
            int left = -min(50, k - 1);
            int right = min(50, n - k);
            int wiggle = rnd.next(left, right);
            k += wiggle;
            if (k < 1) k = 1;
            if (k > n) k = n;
        }

        a = buildHardArray(seedVal, n);
    }

    cout << 1 << "\n";
    if (mode == "non") {
        cout << n << " " << k << "\n";
        for (int i = 1; i <= n; i++) {
            if (i > 1) cout << " ";
            cout << a[i];
        }
        cout << "\n";
        return 0;
    }

    if (mode == "adp") {
        cout << n << " " << k << "\n";

        int deltaGlobal = 0;
        if (seedVal > 3) deltaGlobal = rnd.next(0, 30);

        for (int i = 1; i <= n; i++) {
            int delta = deltaGlobal;
            if (seedVal > 3) {
                if (i % 97 == 0 || i % 101 == 0) {
                    delta = max(delta, n);
                } else if (i % 7 == 0) {
                    delta = max(delta, 5);
                } else {
                    delta = max(delta, rnd.next(0, deltaGlobal));
                }
            }

            long long loLL = (long long)a[i] - (long long)delta;
            long long hiLL = (long long)a[i] + (long long)delta;
            int lo = (int)max(1LL, loLL);
            int hi = (int)min((long long)n, hiLL);
            if (lo > hi) swap(lo, hi);
            cout << lo << " " << hi << "\n";
        }
        return 0;
    }

    quitf(_fail, "Unknown mode: %s", mode.c_str());
    return 0;
}