#include <bits/stdc++.h>
using namespace std;

int n, k, X[1000];

void start() {
    for (int i = 0; i < n; i++) X[i] = 0;
    for (int i = n - k; i < n; i++) X[i] = 1;
}

bool next_combination() {
    int i = n - 1;
    while (i >= 0 && X[i] == 1) {
        X[i] = 0;
        --i;
    }
    if (i < 0) return false; // Hết tổ hợp

    X[i] = 1;
    
    // Đưa tất cả số `1` về cuối
    int ones = 0;
    for (int j = i + 1; j < n; j++) {
        if (X[j] == 1) ones++;
        X[j] = 0;
    }
    for (int j = n - ones; j < n; j++) {
        X[j] = 1;
    }
    
    return true;
}

void generate() {
    do {
        for (int i = 0; i < n; i++) cout << X[i];
        cout << endl;
    } while (next_combination());
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        cin >> n >> k;
        start();
        generate();
    }
    return 0;
}
