#include using namespace std; typedef long long ll; map mp; map mp2; int t[4] = {100000, 100000, 100000, 100000}; int r, c, k, x, y; void upd(){ string s; cin >> s; if (s == "yuck!") exit(0); cin >> x; t[mp[s]] -= x; } int XOR(){ return t[0] ^ t[1] ^ t[2] ^ t[3]; } int main(){ ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); mp["right"] = 0; mp2[0] = "right"; mp["bottom"] = 1; mp2[1] = "bottom"; mp["left"] = 2; mp2[2] = "left"; mp["top"] = 3; mp2[3] = "top"; cin >> r >> c >> k; for (int i = 0; i < k; i ++){ cin >> x >> y; t[0] = min(c - y, t[0]); t[2] = min(y - 1, t[2]); t[1] = min(r - x, t[1]); t[3] = min(x - 1, t[3]); } if (XOR() == 0){ cout << "pass" << endl; upd(); } while (true){ //cout << "t: "; //for (int i = 0; i < 4; i ++) // cout << t[i] << " "; cout << endl; cout << "XOR: " << XOR() << endl; bool ok = false; for (int i = 0; i < 4 and !ok; i ++) if (t[i] >= (t[i] ^ XOR())){ ok = true; cout << mp2[i] << " "; cout << t[i] - (t[i] ^ XOR()) << endl; t[i] ^= XOR(); } upd(); } return 0; }