#include #define ll unsigned long long #define REP(i, n) for(ll i=0;i sides; void getReply() { string side; ll num; cin >> side; if(side == "yuck!") exit(0); cin >> num; sides[side] -= num; } int main(){ cin >> R >> C >> K; ll left = 99999, right = 99999, top = 99999, bottom = 99999; REP(i, K) { ll x, y; cin >> x >> y; if(y-1 < left) left = y-1; if(x-1 < top) top = x-1; if(C-y < right) right = C-y; if(R-x < bottom) bottom = R-x; } sides = { {"left", left}, {"right", right}, {"top", top}, {"bottom", bottom} }; X = sides["left"] ^ sides["right"] ^ sides["top"] ^ sides["bottom"]; if(X == 0) { cout << "pass" << endl; getReply(); } while(1) { X = sides["left"] ^ sides["right"] ^ sides["top"] ^ sides["bottom"]; for(string side : {"left", "right", "top", "bottom"}) { ll reply = sides[side] - (sides[side] ^ X); if(reply > 0 && sides[side] >= reply) { sides[side] -= reply; cout << side << " " << reply << endl; getReply(); break; } } } }