#include using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (n); i++) bool jeho_tah(int& d1, int& d2, int& d3, int& d4) { string s; cin >> s; if (s == "yuck!") return true; int i; cin >> i; if (s == "top") d1 -= i; if (s == "bottom") d3 -= i; if (s == "left") d2 -= i; if (s == "right") d4 -= i; return false; } bool skus(int& d, int x, string s) { if ((d^x) >= d) return false; cout << s << ' ' << (d - (d^x)) << endl; d = d^x; return true; } int main(void){ int r, c, k; cin >> r >> c >> k; int d1 = r, d2 = c, d3 = r, d4 = c; for (int i = 0; i < k; i++) { int a, b; cin >> a >> b; a--; b--; d1 = min(d1, a); d2 = min(d2, b); d3 = min(d3, r-1-a); d4 = min(d4, c-1-b); } if ((d1 ^ d2 ^ d3 ^ d4) == 0) { cout << "pass" << endl; if (jeho_tah(d1, d2, d3, d4)) return 0; } while (true) { int x = d1 ^ d2 ^ d3 ^ d4; skus(d1, x, "top") || skus(d2, x, "left") || skus(d3, x, "bottom") || skus(d4, x, "right"); if (jeho_tah(d1, d2, d3, d4)) return 0; } }