#include <iostream>
using namespace std;
int N, T;
int A[3009], B[3009], C[3009], D[3009];
int main() {
// Input
cin >> N >> T;
for (int i = 1; i <= N; i++) cin >> A[i] >> B[i] >> C[i] >> D[i];
// Output
for (int i = 1; i <= T; i++) {
int CurrentMoney;
int CurrentCorps;
cin >> CurrentMoney >> CurrentCorps;
cout << "3" << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IE4sIFQ7CmludCBBWzMwMDldLCBCWzMwMDldLCBDWzMwMDldLCBEWzMwMDldOwoKaW50IG1haW4oKSB7CgkvLyBJbnB1dAoJY2luID4+IE4gPj4gVDsKCWZvciAoaW50IGkgPSAxOyBpIDw9IE47IGkrKykgY2luID4+IEFbaV0gPj4gQltpXSA+PiBDW2ldID4+IERbaV07CgoJLy8gT3V0cHV0Cglmb3IgKGludCBpID0gMTsgaSA8PSBUOyBpKyspIHsKCQlpbnQgQ3VycmVudE1vbmV5OwoJCWludCBDdXJyZW50Q29ycHM7CgkJY2luID4+IEN1cnJlbnRNb25leSA+PiBDdXJyZW50Q29ycHM7CgkJY291dCA8PCAiMyIgPDwgZW5kbDsKCX0KCXJldHVybiAwOwp9