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

#include <fstream>
#include <iostream>
#include <vector>

using namespace std;

void solve(int M) {
    int RJ, CJ;
    cin >> RJ >> CJ;

    int N;
    cin >> N;
    vector<int> P(2*N);
    for (int i=0; i<N; ++i) {
        cin >> P[2*i] >> P[2*i+1];
    }

    // insert your code here

    cout << 42 << endl; // print the result
}

int main() {
    // uncomment the following lines if you want to read/write from files
    // ifstream cin("input.txt");
    // ofstream cout("output.txt");

    int M, T;
    cin >> M >> T;

    for (int i=0; i<T; ++i) {
        solve(M);
    }

    return 0;
}
