#include using namespace std; using ll = long long; using Vi = vector; using Pii = pair; #define mp make_pair #define pb push_back #define x first #define y second #define rep(i,b,e) for(int i = (b); i < (e); i++) #define each(a, x) for(auto& a : (x)) #define all(x) (x).begin(),(x).end() #define sz(x) int((x).size()) const int maxC = 1e5; void solve() { int r, c, k; cin >> r >> c >> k; int minx = maxC, miny = maxC, maxx = 0, maxy = 0; for (int i = 0; i < k; i++) { int x, y; cin >> x >> y; minx = min(minx, x); miny = min(miny, y); maxx = max(maxx, x); maxy = max(maxy, y); } int top = minx - 1; int bottom = r - maxx; int left = miny - 1; int right = c - maxy; //cout << top << " " << bottom << " " << left << " " << right << endl; while (true) { if ((top ^ bottom ^ left ^ right) == 0) { cout << "pass" << endl; } else { bool flag = false; if (!flag) { for (int i = 0; i < top; i++) { if ((i^ bottom ^ left ^ right) == 0) { cout << "top " << top - i << endl; top = i; flag = true; break; } } } if (!flag) { for (int i = 0; i < bottom; i++) { if ((top^ i ^ left ^ right) == 0) { cout << "bottom " << bottom - i << endl; flag = true; bottom = i; break; } } } if (!flag) { for (int i = 0; i < left; i++) { if ((top^ bottom ^ i ^ right) == 0) { cout << "left " << left - i << endl; flag = true; left = i; break; } } } if (!flag) { for (int i = 0; i < right; i++) { if ((top^ bottom ^ left ^ i) == 0) { cout << "right " << right - i << endl; flag = true; right = i; break; } } } } string s; cin >> s; if (s == "yuck!") { assert((top ^ bottom ^ left ^ right) == 0); break; } else { int x; cin >> x; if (s == "top") top -= x; if (s == "botom") bottom -= x; if (s == "left") left -= x; if (s == "right") right -= x; } } } int main() { cin.sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(12); solve(); return 0; }