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

import java.util.*;
import java.io.*;
import java.lang.*;

public class airplane {

    public static void main(String[] args) throws FileNotFoundException, IOException {
        Locale.setDefault(Locale.US);
        InputStream fin = System.in;
        OutputStream fout = System.out;
        // uncomment the two following lines if you want to read/write from files
        // fin = new FileInputStream("input.txt");
        // fout = new FileOutputStream("output.txt");

        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fout));
        reader = new BufferedReader(new InputStreamReader(fin));
        scn = new StringTokenizer(reader.readLine());

        int T = Integer.parseInt(next());
        for (int test = 1; test <= T; ++test) {
            int N = Integer.parseInt(next());
            int H = Integer.parseInt(next());
            int W = Integer.parseInt(next());

            int[] x_wall = new int[W];
            for (int i = 0; i < W; ++i)
                x_wall[i] = Integer.parseInt(next());

            int[] start_hole = new int[W];
            for (int i = 0; i < W; ++i)
                start_hole[i] = Integer.parseInt(next());

            int[] end_hole = new int[W];
            for (int i = 0; i < W; ++i)
                end_hole[i] = Integer.parseInt(next());

            String ans = "";


            // INSERT YOUR CODE HERE


            writer.write(ans);
            writer.write('\n');
        }

        writer.flush();
    }

    static String next() throws IOException {
        while (!scn.hasMoreTokens()) scn = new StringTokenizer(reader.readLine());
        return scn.nextToken();
    }

    static BufferedReader reader;
    static StringTokenizer scn;
}
