// 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>

// constraints
#define MAXN 100000

// input data
int M, T, RJ, CJ, N;
int P[2*MAXN];

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

    assert(2 == scanf("%d %d\n", &M, &T));
    while (T--) {
        assert(2 == scanf("%d %d\n", &RJ, &CJ));
        
        assert(1 == scanf("%d\n", &N));
        for (int i = 0; i < N; ++i) {
            assert(2 == scanf("%d %d", &P[2*i], &P[2*i+1]));
        }

        // insert your code here

        printf("%d\n", 42); // print the result
    }
    
    return 0;
}
