#include #include #include #include #include #include #include using namespace std; typedef long long LL; int main() { int n, m, r; scanf("%d %d %d", &n, &m, &r); int mni=n+m, mnj=n+m, mxi=0, mxj=0; for (int i = 0; i < r; i++){ int a,b; scanf("%d %d", &a, &b); mni = min(mni, a); mnj = min(mnj, b); mxi = max(mxi, a); mxj = max(mxj, b); } int a=mni-1,b=mnj-1,c=n-mxi,d=m-mxj; string s; int sz; if ((a^b^c^d)==0) { cout<<"pass"<>s; if (s == "yuck!") return 0; cin>>sz; if (s == "left") b -= sz; if (s == "top") a -= sz; if (s == "right") d -= sz; if (s == "bottom") c -= sz; } while ((a^b^c^d) != 0) { if ((a^b^c) <= d) { cout<<"right "<>s; if (s == "yuck!") return 0; cin>>sz; if (s == "left") b -= sz; if (s == "top") a -= sz; if (s == "right") d -= sz; if (s == "bottom") c -= sz; } return 0; }