-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathADASHOP2.py
61 lines (50 loc) · 1.12 KB
/
ADASHOP2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# cook your dish her
def sequence():
print("2 2")
print("1 3")
print("3 1")
print("2 2")
print("3 3")
print("1 5")
print("5 1")
print("3 3")
print("4 4")
print("1 7")
print("7 1")
print("4 4")
print("5 5")
print("2 8")
print("8 2")
print("5 5")
print("6 6")
print("4 8")
print("8 4")
print("6 6")
print("7 7")
print("6 8")
print("8 6")
print("7 7")
print("8 8")
if __name__=='__main__':
try:
t = int(input())
except:
t = 0
for _ in range(t):
r, c = map(int, input().rstrip().split())
steps_required = 25
if r == c and r == 1:
print(steps_required)
sequence()
elif r == c:
steps_required += 1
print(steps_required)
print("1 1")
sequence()
else:
steps_required += 2
z = (r+c)//2
print(steps_required)
print(z, z)
print("1 1")
sequence()