#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);
}
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);
vi bits;
for(int b = 0; b <= 9; b++) {
if(!rsp[2*b] or !rsp[2*b+1] or b == dif) continue;
bits.pb(b);
vi pos;
for(int i = 1; i <= N; i++)
if((i & (1<<b)) and (i & (1<<dif))) pos.pb(i);
send(pos);
}
rsp = wait();
for(int i = 0; i < sz(bits); i++) {
int b = bits[i], r = rsp[i];
if(r) A += (1<<b);
else B += (1<<b);
}
return mk(A, B);
}