# Input
N, T = map(int, input().split())
A = [ 0 ] * N
B = [ 0 ] * N
C = [ 0 ] * N
D = [ 0 ] * N
for i in range(N):
A[i], B[i], C[i], D[i] = map(int, input().split())
# Interaction
for i in range(T):
CurrentMoney = 0
CurrentCorps = 0
CurrentMoney, CurrentCorps = map(int, input().split())
print("3")
IyBJbnB1dApOLCBUID0gbWFwKGludCwgaW5wdXQoKS5zcGxpdCgpKQpBID0gWyAwIF0gKiBOCkIgPSBbIDAgXSAqIE4KQyA9IFsgMCBdICogTgpEID0gWyAwIF0gKiBOCmZvciBpIGluIHJhbmdlKE4pOgoJQVtpXSwgQltpXSwgQ1tpXSwgRFtpXSA9IG1hcChpbnQsIGlucHV0KCkuc3BsaXQoKSkKCiMgSW50ZXJhY3Rpb24KZm9yIGkgaW4gcmFuZ2UoVCk6CglDdXJyZW50TW9uZXkgPSAwCglDdXJyZW50Q29ycHMgPSAwCglDdXJyZW50TW9uZXksIEN1cnJlbnRDb3JwcyA9IG1hcChpbnQsIGlucHV0KCkuc3BsaXQoKSkKCXByaW50KCIzIik=