import math import random # N = 3000, T = 400 N, T = map(int, input().split()) ABCD = [map(int, input().split()) for _ in range(N)] block = [[0] * 14 for _ in range(14)] bridge = set() def build(): direction = [(1,0), (-1,0), (0,1), (0,-1)] while True: x = random.randint(0, 13) y = random.randint(0, 13) for i, v in direction: z = x + i w = y + v score = x + y * 14 + z * 14 ** 2 + w * 14 **3 if 0 <= z <= 13 and 0 <= w <= 13 and not score in bridge: bridge.add(score) return x, y, z, w for i in range(T): u, v = map(int, input().split()) if i > 300: print(3) elif u * math.sqrt(v) < 10**7: print(2) else: x, y, z, w = build() print(1, x+1, y+1, z+1, w+1)