#include<bits/stdc++.h>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int t, i, n, m, sr = 0, sk = 0, a[100][100];
	cin >> t;
    bool moguce;
	for(i = 0; i < t; i++){
		cin >> n >> m;
        moguce = true;
        
		if(n == m) moguce = true;
        else moguce = false;

		if(moguce == true){
			cout << "1 1 1 1" << "\n";
            cout << "1 0 0 1" << "\n";
            cout << "1 0 1 1" << "\n";
            cout << "1 1 1 1" << "\n";
		}
		else{
			cout << "-1" << "\n";
		}
			
	}
	return 0;
}

/*for(r = 0; r < n; r++){
			for(k = 0; k < m; k++)cout << a[r][k] << " ";
			cout << "\n";	
		}*/