// Subtasks:
// _: AC

#include <iostream>
#include <random>
#include <vector>
#include <algorithm>

using namespace std;

#define ll long long;

bool b[555][555];
char q[555][555];

char query(int i, int j) {
    if (q[i][j] == '<' || q[i][j] == '>') return q[i][j];
    cout<<"? "<<i<<" "<<j<<endl;
    cin>>q[i][j];
    if (q[i][j] == '<') q[j][i] = '>';
    else q[j][i] = '<';
    return q[i][j];
}

int main() {
    srand(time(0));

    int n, t;
    cin>>n>>t;

    for (int i = 0; i < n; i++) {
        if (n > 10) {
            for (int j = 0; j < n; j++) {
                if (i <= j) b[i][j] = (rand() % (2 - (i == j)));
                else b[i][j] = 1 - b[j][i];
            }
        } else {
            for (int j = 1; j <= n / 2; j++) {
                int k = (i + j) % n;
                b[i][k] = 1;
                b[k][i] = 0;
            }
        }
    }
    if (n > 10) {
        for (int x = 0; x < 100; x++) {
            for (int i = 0; i < n; i++) {
                int c0 = 0;
                int c1 = 0;
                for (int j = 0; j < n; j++) {
                    if (b[i][j]) c1++;
                    else c0++;
                }
                int f = c1 >= c0 - 1;
                while (abs(c1 - c0 + 1) > 1) {
                    int j = rand() % n;
                    if (j != i && b[i][j] == f) {
                        b[i][j] = 1 - f;
                        b[j][i] = f;
                        if (f) {
                            c1--;
                            c0++;
                        } else {
                            c1++;
                            c0--;
                        }
                    }
                }
            }
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) cout<<b[i][j];
        cout<<endl;
    }

    for (int ti = 0; ti < t; ++ti) {
        for (int i = 1; i <= n; ++i) {
            for (int j = 1; j <= n; ++j) {
                q[i][j] = 0;
            }
        }
        vector<int> o = {1}; // x>y>...>z
        for (int i = 2; i <= n; i++) {
            char cb = query(i, o.back());
            if (cb == '<') {
                o.push_back(i);
                // o.insert(o.begin(), i);
            } else {
                for (int j = 0; j + 1 < o.size(); j++) {
                    char c2 = query(i, o[o.size() - 2 - j]);
                    if (c2 == '<') {
                        o.insert(o.begin() + o.size() - 1 - j, i);
                        goto nxt;
                    }
                }
                o.insert(o.begin(), i);
                nxt:;
            }
        }

        vector<int> slice;
        while (true) {
            char c = query(o[0], o.back());
            if (c == '<') break;
            slice.push_back(o.back());
            o.pop_back();
        }
        if (slice.empty()) {
            cout<<"!";
            for (int i : o) cout<<" "<<i;
            cout<<endl;
            goto end;
        }
        reverse(slice.begin(), slice.end());
        for (int j = 0; j + 1 < o.size(); j++) {
            char c1 = query(o[j], slice[0]);
            if (c1 == '>') {
                char c2 = query(slice.back(), o[j + 1]);
                if (c2 == '>') {
                    while (!slice.empty()) {
                        o.insert(o.begin() + j + 1, slice.back());
                        slice.pop_back();
                    }
                    cout<<"!";
                    for (int i : o) cout<<" "<<i;
                    cout<<endl;
                    goto end;
                }
            }
        }
        end:;
    }
    return 0;
}
