#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); for (int i = 0; i < k; i++){ cin >> a[i].first >> a[i].second; } sort(a.begin(),a.end()); m["top"] = a[0].first-1; m["bottom"] = r-a.back().first; m["left"] = a[0].second-1; m["right"] = c-a.back().second; 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; }