#include using namespace std; typedef long long LL; typedef long double LD; typedef pair < int, int > PII; typedef pair < LL, LL > PLL; #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() int r, c, k; int a[4]; int get4xor() { return a[0] ^ a[1] ^ a[2] ^ a[3]; } int get3xor(int e) { return get4xor() ^ a[e]; } int getsum() { return a[0] + a[1] + a[2] + a[3]; } void update() { string s; cin >> s; if(s[0] == 'y') exit(0); int x; cin >> x; if(s[0] == 'l') a[0] -= x; if(s[0] == 'r') a[1] -= x; if(s[0] == 't') a[2] -= x; if(s[1] == 'b') a[3] -= x; } int main() { // ios_base::sync_with_stdio(0); cin.tie(0); cin >> r >> c >> k; swap(r, c); vector < int > X, Y; for(int i = 0; i < k; i++) { int x, y; cin >> x >> y; swap(x, y); X.push_back(x); Y.push_back(y); } a[0] = *min_element(all(X)) - 1; a[1] = r - *max_element(all(X)); a[2] = *min_element(all(Y)) - 1; a[3] = c - *max_element(all(Y)); int xr = get4xor(); // cerr << a[0] << " " << a[1] << " " << a[2] << " " << a[3] << " " << xr << "\n"; if(xr == 0) { cout << "pass" << endl; cout.flush(); update(); } string st[] = {"left", "right", "top", "bottom"}; while(true) { xr = get4xor(); assert(xr != 0); bool done = false; for(int i = 0; i < 4; i++) { int x = get3xor(i); if(x < a[i]) { cout << st[i] << " " << a[i] - x << endl; cout.flush(); a[i] = x; done = true; break; } } assert(done); update(); } return 0; }