#include <bits/stdc++.h>
#define LIMIT 3
#define SIZE n[i]
#define print_full for(x = 0; x < SIZE; ++x) printf("1");
#define print_vector for(x = 0; x < SIZE; printf("%i", v[x++]));

using namespace std;

int main() {
    int t, i, y, x;

    int n[LIMIT];
    int m[LIMIT];

    scanf("%d", &t);
    for (i = 0; i < t; ++i) {
        scanf("%d %d", &n[i], &m[i]);
    }

    for (i = 0; i < t; ++i) {
        if (SIZE != m[i]) {
            printf("-1\n");
            continue;
        }

        auto v = vector<int>(SIZE);
        fill(v.begin(), v.end(), 0);
        v[0] = 1;

        for(int y = 0; y < SIZE; ++y) {
            if(y == 0 || y == SIZE-1) {
                print_full
            } else {
                v[SIZE-y] = 1;
                print_vector
            }
            printf("\n");
        }
    }
}