#include #define st first #define nd second #define fi first #define se second #define pb push_back #define loop(i,j,n) for(int i=j;i pll; const int MAX = 200010; int t,r,b,l; int txor() { return ((t^b)^l)^r; } void omv(string s, int a) { if(s=="left") l-=a; else if(s=="right") r-=a; else if(s=="top") t-=a; else if(s=="bottom") b-=a; } pair findmv() { loop(i,1,t+1) { t-=i; if(txor() == 0) { return {"top", i}; } t+=i; } loop(i,1,b+1) { b-=i; if(txor() == 0) { return {"bottom", i}; } b+=i; } loop(i,1,r+1) { r-=i; if(txor() == 0) { return {"right", i}; } r+=i; } loop(i,1,l+1) { l-=i; if(txor() == 0) { return {"left", i}; } l+=i; } return {"left", 1}; } int main() { ios_base::sync_with_stdio(0); int R,C,K; cin>>R>>C>>K; int minx=200000,miny=2000000, maxx = 0, maxy=0; int x,y; loop(i,0,K) { cin>>x>>y; maxx=max(x, maxx); maxy=max(y, maxy); minx = min(x, minx); miny = min(y,miny); } t=minx-1; b=R-maxx; l = miny-1; r = C-maxy; if(txor() == 0) { pln("pass"); string om; int a; cin>>om>>a; omv(om, a); } string res=""; while(true) { pair m = findmv(); cout<>res; if(res == "yuck!") { return 0; } cin>>a; omv(res, a); } return 0; }