#include using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) template bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;} template bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;} const long long mod=998244353; const long long mod2=469762049; const long long mod100=1000000007; void solve(){ int H,W;cin>>H>>W; int x,y;cin>>x>>y; if(H==3){ cout<<1<<" "<>x>>y; cout<<2<<" "<>x>>y; if(x==0 && y==0) return; cout<>x>>y; if(x==0 && y==0) return; cout<>x>>y; if(x==0 && y==0) return; assert(0); } int main(){ cout.tie()->sync_with_stdio(0); cin.tie(0); int T;cin>>T; while(T--) solve(); }