#include "avoid.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second
pii scout(int R, int H) {
int N = 1000;
for(int b = 0; b <= 9; b++) {
vi pos1, pos0;
for(int i = 1; i <= N; i++) {
if(i & (1<<b)) pos1.pb(i);
else pos0.pb(i);
}
send(pos1);
send(pos0);
}
int corr[10][10];
for(int b = 0; b <= 9; b++) {
for(int bb = b+1; bb <= 9; bb++) {
vi pos;
for(int i = 1; i <= N; i++)
if((i & (1<<b)) and (i & (1<<bb)))
pos.pb(i);
corr[b][bb] = sz(pos);
send(pos);
}
}
vi rsp = wait();
int dif = -1, A = 0, B = 0;
for(int b = 0; b <= 9; b++) {
if(rsp[2*b] and rsp[2*b+1])
dif = b;
else if(rsp[2*b]) A += (1<<b), B += (1<<b);
}
if(dif == -1) return mk(A, B);
A += (1<<dif);
for(int b = 0; b <= 9; b++) {
if(!rsp[2*b] or !rsp[2*b+1] or b == dif) continue;
int x = min(b, dif), y = max(b, dif);
if(rsp[corr[x][y]]) A += (1<<b);
else B += (1<<b);
}
return mk(A, B);
}