#include <vector>
#include <string>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int n, b;
string ans, opt;
bool Query(int pos, const string &now, bool t)
{
	cout << pos << " " << ans << now;
	for (int i = ans.size() + now.size(); i < b; ++ i)
		putchar(t ? '1' : '0');
	cout << endl;
	cin >> opt;
	return opt[0] == 'y';
}
void Solve(vector<int>idx)
{
	if ((int)ans.size() == b)
		return;
	if (!idx.size() == b)
	{
		while (ans.size() < b)
			ans += "0";
		return;
	}
	vector<int> stk;
	string cur = Query(idx[0], "0", 1) ? "1" : "0";
	bool flg;
	stk.push_back(idx[0]);
	for (int i = 1; i < (int)idx.size(); i++)
	{
		int p = idx[i];
		flg = 0;
		while (!stk.empty() && Query(p, cur, 1))
		{
			cur.pop_back();
			stk.pop_back();
			flg = 1;
		}
		if ((int)(ans.size() + cur.size()) == b)
			continue;
		cur += flg || Query(p, cur + "0", 1) ? "1" : "0";
		stk.push_back(p);
	}
	for (int i = stk.size() - 1; i >= 0; i--)
		if (Query(stk[i], cur, 1))
			while ((int)stk.size() > i + 1)
			{
				cur.pop_back();
				stk.pop_back();
			}
	ans += cur;
	Solve(stk);
}
int main()
{
	scanf("%d%d", &n, &b);
	vector<int> tmp;
	for (int i = 1; i <= n; ++ i)
		tmp.push_back(i);
	Solve(tmp);
	cout << "0 " << ans << endl;
}

   	  	 		  					 						   	 	