// NOTE: it is recommended to use this even if you don't understand the following code.

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define MAXS 128
#define MAXW 500

int  H, N, T, W, i, test;
int  end_hole[MAXW], start_hole[MAXW], x_wall[MAXW];
char ans[MAXS];

int main() {
    // uncomment the two following lines if you want to read/write from files
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    assert(1 == scanf("%d", &T));
    for (test = 1; test <= T; ++test) {
        assert(3 == scanf("%d%d%d", &N, &H, &W));

        for (i = 0; i < W; ++i)
            assert(1 == scanf("%d", &x_wall[i]));

        for (i = 0; i < W; ++i)
            assert(1 == scanf("%d", &start_hole[i]));

        for (i = 0; i < W; ++i)
            assert(1 == scanf("%d", &end_hole[i]));

        ans[0] = 0;


        // INSERT YOUR CODE HERE


        printf("%s\n", ans);
    }

    return 0;
}
