#include using namespace std; using ll = long long; using P = pair; #define rep(i, n) for(ll i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> t; rep(houren,t){ int h,w,x=2,y=2; cin >> h >> w; if(h%3==1) x=0; if(w%3==1) y=0; rep(i,h){ rep(j,w){ if(i%3==x && j%3==y) cout << 0 << " "; else if(i%3==x || j%3==y) cout << 1 << " "; else cout << 2 << " "; } cout << '\n'; } } return 0; }