#include using namespace std; string str, rstr; int arr[4]; int get_xor(){ return arr[0] ^ arr[1] ^ arr[2] ^ arr[3]; } void update(string &s, int x){ if(s == "top"){ arr[1] -= x; } if(s == "bottom"){ arr[0] -= x; } if(s == "left"){ arr[3] -= x; } if(s == "right"){ arr[2] -= x; } } int main() { int r, c, k; int left = 100010, right = -1; int top = -1, bot = 111111; scanf("%d%d%d", &r, &c, &k); while(k--){ int x, y; scanf("%d%d", &x, &y); left = min(left, y); right = max(right, y); top = max(top, x); bot = min(bot, x); } arr[0] = r - top; arr[1] = bot - 1; arr[2] = c - right; arr[3] = left - 1; // cout << arr[0] << " " << arr[1] << " " << arr[2] << " " << arr[3] << ": " << get_xor()<< endl; int x; string str = ""; if(get_xor() == 0){ cout << "pass" << endl; cin >> str; if(str == "yuck!"){ return 0; } cin >> x; update(str, x); } // cout << "dela" << endl; // cout << arr[0] << " " << arr[1] << " " << arr[2] << " " << arr[3] << ": " << get_xor()<< endl; while(str != "yuck!"){ for(int i = 0; i < 4; i++){ for(int j = 1; j <= arr[i]; j++){ arr[i] -= j; if(get_xor() == 0){ if(i == 1){ cout << "top " << j << endl; } if(i == 0){ cout << "bottom " << j << endl; } if(i == 3){ cout << "left " << j << endl; } if(i == 2){ cout << "right " << j << endl; } break; } else{ arr[i] += j; } } } cin >> str; if(str == "yuck!"){ break; } cin >> x; update(str, x); } return 0; }