// Subtasks:
// 1: AC
// 2: AC
// 3: AC
// 4: WA

// phase 1: ring
// phase 2: quicksort, 1st element is pivot

#include <iostream>
#include <vector>

using namespace std;

bool ask(int u, int v) {
    cout << "? " << u << " " << v << endl;
    char ans;
    cin >> ans;
    return ans == '>';
}

int arr[501];

void quicksort(int b, int e) {
    if (e-b <= 1) return;
    int pivot = arr[b];
    vector<int> l, r;
    for (int i = b+1; i < e; ++i) {
        if (ask(pivot, arr[i])) r.push_back(arr[i]);
        else l.push_back(arr[i]);
    }
    int i = b;
    for (int x : l) arr[i++] = x;
    int mid = i;
    arr[i++] = pivot;
    for (int x : r) arr[i++] = x;
    quicksort(b, mid);
    quicksort(mid+1, e);
}

int main() {
    int n, t;
    cin >> n >> t;

    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (i != j && (j > i) != (abs(j-i) <= n/2)) cout << 1;
            else cout << 0;
        }
        cout << endl;
    }

    for (int ti = 0; ti < t; ++ti) {
        for (int i = 1; i <= n; ++i) arr[i] = i;
        quicksort(1, n+1);

        cout << "! ";
        for (int i = 1; i <= n; ++i) cout << arr[i] << " ";
        cout << endl;
    }
}
