#include using namespace std; typedef long long ll; typedef double lf; typedef pair pii; typedef pair pll; #define TRACE(x) cerr << #x << ' ' << x << endl #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define REP(i, n) FOR(i, 0, n) #define _ << ' ' << #define fi first #define sec second #define se second #define mp make_pair #define pb push_back const int inf = 1e5; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int minx = inf, maxx = 0, miny = inf, maxy = 0; int r, c, k; cin >> r >> c >> k; REP(i, k) { int x, y; cin >> x >> y; x --; y --; minx = min(x, minx); miny = min(y, miny); maxx = max(x, maxx); maxy = max(y, maxy); } int tmp_left = miny; int tmp_right = c - maxy - 1; int tmp_up = minx; int tmp_down = r - maxx - 1; int tmp = ((tmp_left ^ tmp_up) ^ tmp_right) ^ tmp_down; if(tmp == 0) { cout << "pass"; cout << endl; string s; cin >> s; if(s[0] == 'y') { return 0; } int x; cin >> x; tmp ^= ((tmp_left ^ tmp_up) ^ tmp_right) ^ tmp_down; if(s[0] == 'l') { tmp_left -= x; } if(s[0] == 'r') { tmp_right -= x; } if(s[0] == 't') { tmp_up -= x; } if(s[0] == 'b') { tmp_down -= x; } tmp ^= ((tmp_left ^ tmp_up) ^ tmp_right) ^ tmp_down; } while(true) { if((tmp ^ tmp_up) < tmp_up) { cout << "top" _ (tmp_up - (tmp^tmp_up)) << endl; tmp_up = tmp^tmp_up; } else if((tmp ^ tmp_left) < tmp_left) { cout << "left" _ (tmp_left - (tmp^tmp_left)) << endl; tmp_left = tmp^tmp_left; } else if((tmp ^ tmp_down) < tmp_down) { cout << "bottom" _ (tmp_down - (tmp^tmp_down)) << endl; tmp_down = tmp^tmp_down; } else if((tmp ^ tmp_right) < tmp_right) { cout << "right" _ (tmp_right - (tmp^tmp_right)) << endl; tmp_right = tmp^tmp_right; } tmp = 0; string s; cin >> s; if(s[0] == 'y') { return 0; } int x; cin >> x; tmp = ((tmp_left ^ tmp_up) ^ tmp_right) ^ tmp_down; if(s[0] == 'l') { tmp_left -= x; } if(s[0] == 'r') { tmp_right -= x; } if(s[0] == 't') { tmp_up -= x; } if(s[0] == 'b') { tmp_down -= x; } tmp ^= ((tmp_left ^ tmp_up) ^ tmp_right) ^ tmp_down; } return 0; }