#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

int main()
{
    int t, n, m;
    cin >> t;
    vector<int> nizn(t);
    vector<int> nizm(t);
    for(int i = 0; i < t; i++){
        cin >> nizn[i] >> nizm[i];
    }

    for(int i = 0; i < t; i++){
        if(nizn[i] != nizm[i]){
            cout << -1 << endl;
        }else{
            for(int j = 1; j <= nizn[i]; j++){
                for(int z = 1; z <= nizn[i] - j; z++){
                    cout << 0 << " ";
                }

                for(int z = 1; z <= j; z++){
                    cout << 1 << " ";
                }

                cout << "" << endl;
            }
        }
    }
}