#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef vector< vector<bool> > vvb;
typedef vector<bool> vb;
vvb pet;
void print(vvb a)
{
for(int i = 1; i < a.size(); i++)
{
for(int j = 1; j < a.size(); j++)
cout << a[i][j];
cout << "\n";
}
fflush(stdout);
}
void bruteforce()
{
print(pet);
int x; cin >> x;
int tot1 = x;
for(int i = 1; i < pet.size(); i++)
{
for(int j = 1; j < pet.size(); j++)
{
pet[i][j] = 1;
print(pet);
cin >> x;
if(x < tot1)
{
pet[i][j] = 1;
tot1--;
}
else pet[i][j] = 0;
}
}
}
int main()
{
string s, t; cin >> s >> t;
int n; cin >> n;
vb temp;
for(int i = 0; i <= n; i++) temp.pb(0);
pet.pb(temp);
for(int i = 1; i <= n; i++)
{
temp.clear();
for(int j = 0; j <= n; j++) temp.pb(0);
pet.pb(temp);
}
bruteforce();
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBwYiBwdXNoX2JhY2sKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWRlZiB2ZWN0b3I8IHZlY3Rvcjxib29sPiA+IHZ2YjsKdHlwZWRlZiB2ZWN0b3I8Ym9vbD4gdmI7CnZ2YiBwZXQ7CnZvaWQgcHJpbnQodnZiIGEpCnsKCWZvcihpbnQgaSA9IDE7IGkgPCBhLnNpemUoKTsgaSsrKQoJewoJCWZvcihpbnQgaiA9IDE7IGogPCBhLnNpemUoKTsgaisrKQoJCWNvdXQgPDwgYVtpXVtqXTsKCQljb3V0IDw8ICJcbiI7Cgl9CglmZmx1c2goc3Rkb3V0KTsKfQp2b2lkIGJydXRlZm9yY2UoKQp7CglwcmludChwZXQpOwoJaW50IHg7IGNpbiA+PiB4OwoJaW50IHRvdDEgPSB4OwoJZm9yKGludCBpID0gMTsgaSA8IHBldC5zaXplKCk7IGkrKykKCXsKCQlmb3IoaW50IGogPSAxOyBqIDwgcGV0LnNpemUoKTsgaisrKQoJCXsKCQkJcGV0W2ldW2pdID0g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