#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000000LL int main(){ int _t; cin>>_t; rep(_,_t){ int n,m; cin>>n>>m; if(n%2||m%2||(n%4&&m%4)){ cout<<-1<> a(n,vector(m)); if(m%4==0){ int cur = 1; for(int i=0;i