//interactive ll a,b; ll m(ll x,ll y){ if(x<1||y<1){ return 0; } if(a==x||b==y||a+b==x+y||a-b==x-y){ a=x; b=y; wt(a,b); return 1; } return 0; } { ll@t; rep(t){ ll@h,@w; a=1; b=1; while(1){ ll@x,@y; if(x<0){ exit(3); } if(x==0){ break; } (h-x