/**
 *  created: 15/01/2021, 21:46:10
**/

#include <bits/stdc++.h>

using namespace std;

const int max_n = 222, inf = 1000111222;
const bool debug = 0;

const int seed = chrono::steady_clock::now().time_since_epoch().count();
mt19937 generator(seed * 1);

int rnd() {
    return generator() >> 1;
}

int rnd(int r) {
    return rnd() % r;
}

int rnd(int l, int r) {
    return l + rnd(r - l + 1);
}

int Q;
string hid[max_n];
int n, b;

bool is_greater(int pos, const string &s) {
    cout << pos + 1 << " " << s << endl;
    ++Q;
    if (debug) {
        cout << "res = " << (bool) (hid[pos] > s) << endl;
        return hid[pos] > s;
    }
    string res;
    cin >> res;
    return res == "yes";
}

void answer(const string &s) {
    if (debug) {
        bool ok = (s == *max_element(hid, hid + n));
        cout << "-+"[ok] << ", Q = " << Q << ", ratio = " << 1.0 * Q / (n + b) << endl;
    }
    cout << "0 " << s << endl;
    exit(0);
}

deque<int> q;

string fill_ones(string s) {
    if (s.size() > b) {
        s = s.substr(0, b);
    }
    while (s.size() < b) {
        s += '1';
    }
    return s;
}

int pos;
string ans;

void proc(int i) {
    while (!q.empty() && is_greater(i, fill_ones(ans))) {
        q.pop_back();
        assert(!ans.empty());
        ans.pop_back();
    }
    if (ans.size() == b) {
        return;
    }
    char c = '0' + is_greater(i, fill_ones(ans + "0"));
    ans += c;
    q.push_back(i);
}

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    if (debug) {
        n = 200;
        b = 200;
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < b; ++j) {
                hid[i] += '0' + rnd(2);
            }
        }
        if (0) {
            cout << n << " " << b << endl;
            for (int i = 0; i < n; ++i) {
                cout << hid[i] << endl;
            }
            cout << endl;
        }
    } else {
        cin >> n >> b;
    }
    for (int i = 0; i < n; ++i) {
        proc(i);
    }
    while (!q.empty()) {
        int id = q.front();
        q.pop_front();
        proc(id);
    }
    answer(ans);
    return 0;
}
