#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = (a); i < b; ++i)
#define rrep(i,a,b) for(int i = (b); i --> (a);)
#define trav(x, v) for(auto &x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) (int)(v).size()

bool que_big(int s, string x){
	cout << s+1 << " " << x << endl;
	string res;
	cin >> res;
	return res == "yes";
}

int main(){
	int n = 200, b = 200;
	cin >> n >> b;

	vector<string> ub(n, string(b, '1'));
	string lb(b, '0');
	deque<int> ko;
	rep(i,0,n) ko.push_back(i);
	string nxt = string(b, '1');
	nxt[0] = '0';
	while(true){
		int s = ko.front();
		if(ub[s] < lb){
			ko.pop_front();
			continue;
		}
		if(ub[s] == lb){
			cout << 0 << " " << lb << endl;
			return 0;
		}
		if(que_big(s, nxt)){
			lb = nxt;
			rrep(i,0,b){
				if(lb[i]=='0'){
					lb[i] = '1';
					nxt[i] = '1';
					break;
				} else {
					lb[i] = '0';
				}
			}
		} else {
			ub[s] = nxt;
			ko.pop_front();
			ko.push_back(s);
			rep(i,0,b) if(nxt[i] > lb[i]){
				nxt[i] = '0';
				break;
			}
		}
	}
}
