#include using namespace std; #define fio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); typedef long long ll; int up,down,left,right,num; string s; map m; vector dirs = {"top","bottom","left","right"}; int grundy(){ int res = 0; for (string d : dirs) res ^= m[d]; return res; } void update(){ m[s] -= num; } void move(){ s = ""; int g = grundy(); for (int i = 31; i >= 0; i--){ if (!(g&(1<> r >> c >> k; vector> a(k); vector> a2(k); vector rows(k); vector cols(k); for (int i = 0; i < k; i++){ cin >> rows[i] >> cols[i]; } sort(rows.begin(),rows.end()); sort(cols.begin(),cols.end()); m["top"] = rows[0]-1; m["bottom"] = r-rows.back(); m["left"] = cols[0]-1; m["right"] = c-cols.back(); s = "aaaa"; if (grundy() == 0){ cout << "pass" << endl; cout.flush(); cin >> s; if (s == "yuck!") return 0; cin >> num; update(); } while (s != "yuck!"){ move(); cin >> s; if (s == "yuck!") return 0; cin >> num; update(); } return 0; }