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)] a = 3 b = 10 while True: x = random.randint(a, b) y = random.randint(a, b) for i, v in direction: z = x + i w = y + v score = x + y * (b - a + 1) + z * (b - a + 1) ** 2 + w * (b - a + 1) **3 if a <= z <= b and a <= w <= b 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)