#include #define ll long long #define ld long double #define fi first #define se second #define pll pair #define INF (1ll << 60) #define ppl pair #define vl vector #define vvl vector #define FOR(i,a,b) for(ll i=a;i mx ) { mx = v[i]; res = i; } } return res; } bool ok(ll pos, vl &v) { ll s = 0; FOR(i,0,4) { s ^= (v[i] & (1 << pos)); } return s == 0; } pll get(vl &v) { ll pos; for(ll i = 33; i >=0; i--) { if(!ok(i, v)) { pos = i; break; } } ll it = find(pos, v); ll res = v[it]; for(ll i = 33; i >=0; i--) { if(!ok(i, v)) { v[it] ^= (1<> R >> C >> K; vl v(4, 1000000); v[2] = 0; v[3] = 0; FOR(i,0,K) { ll a, b; cin >> a >> b; a--;b--; v[0] = min(v[0], b); v[1] = min(v[1], a); v[2] = max(v[2], b); v[3] = max(v[3], a); } v[2] = C - v[2] - 1; v[3] = R - v[3] - 1; // pv(v); map msi{{"left", 0}, {"top", 1}, {"right", 2}, {"bottom", 3}}; map mis{{0, "left"}, {1, "top"}, {2, "right"}, {3, "bottom"}}; if(xo(v) == 0) { cout << "pass" << endl; cout.flush(); } else { auto p = get(v); cout << mis[p.first] << " " << p.second << endl; cout.flush(); } while(1) { string s; cin >> s; if(s == "yuck!") return 0; ll x, it = msi[s]; cin >> x; v[it] -= x; auto p = get(v); cout << mis[p.first] << " " << p.second << endl; cout.flush(); } } // 4 6 2 2 3 4 4 // 3 5 1 2 3