#include <bits/stdc++.h>
#define fo(a,b,c) for (a=b; a<=c; a++)
#define fd(a,b,c) for (a=b; a>=c; a--)
#define ll long long
using namespace std;

int n,N,B,i,j,k,l,t,L;
int a[201],d[201];
char ans[201];
string St;

char Query(int t,string st)
{
	static char St[5];
	int i;
	printf("%d ",t);
	fo(i,0,B-1) printf("%c",st[i]);printf("\n");
	fflush(stdout);
	
	scanf("%s",St+1);
	return (St[1]=='n')?'0':'1';
}
void get1(int t) //next
{
	int i;
	St="";fo(i,1,t-1) St+=ans[i];St+='0';
	fo(i,t+1,B) St+='1';
}
void get2(int t) //larger
{
	int i;
	St="";fo(i,1,t) St+=ans[i];
	fo(i,t+1,B) St+='1';
}

int main()
{
	scanf("%d%d",&n,&B);
	fo(i,1,n) a[i]=i;N=n;L=0;
	while (N && L<B)
	{
		t=L+1;d[t]=a[1];
		get1(t);ans[t]=Query(a[1],St);
		
		fo(i,2,N)
		{
			while (t>L)
			{
				get2(t);
				if (Query(a[i],St)=='1') --t;
				else break;
			}
			d[++t]=a[i];
			get1(t);ans[t]=Query(a[i],St);
		}
		fd(i,t,L+1)
		{
			get2(t);
			if (Query(d[i],St)=='1') t=i;
		}
		fo(i,L+1,t) a[i-L]=d[i];N=t-L;L=t;
	}
	
	printf("0 ");
	fo(i,1,B) printf("%c",ans[i]);printf("\n");
	fflush(stdout);
}