from itertools import combinations
def main():
N = int(input())
poses = {tuple(map(int, x)) for x in zip(*[input().strip().split() for _ in range(3)])}
for from_pos, to_pos in combinations(poses, 2):
ghost_pos = list(from_pos)
x_dir = (to_pos[0] > ghost_pos[0]) - (to_pos[0] < ghost_pos[0])
y_dir = (to_pos[1] > ghost_pos[1]) - (to_pos[1] < ghost_pos[1])
z_dir = (to_pos[2] > ghost_pos[2]) - (to_pos[2] < ghost_pos[2])
while ghost_pos != list(to_pos):
if ghost_pos[0] != to_pos[0] and (ghost_pos[0]+x_dir, ghost_pos[1], ghost_pos[2]) in poses:
ghost_pos[0] += x_dir
elif ghost_pos[1] != to_pos[1] and (ghost_pos[0], ghost_pos[1]+y_dir, ghost_pos[2]) in poses:
ghost_pos[1] += y_dir
elif ghost_pos[2] != to_pos[2] and (ghost_pos[0], ghost_pos[1], ghost_pos[2]+z_dir) in poses:
ghost_pos[2] += z_dir
else:
print("NO")
return
print("YES")
main()
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 17ms | 3124 KiB | ||||
2 | Accepted | 17ms | 3116 KiB | ||||
3 | Accepted | 17ms | 3128 KiB | ||||
subtask2 | 18/18 | ||||||
4 | Accepted | 17ms | 3096 KiB | ||||
5 | Accepted | 16ms | 3112 KiB | ||||
6 | Accepted | 97ms | 3244 KiB | ||||
7 | Accepted | 32ms | 3240 KiB | ||||
8 | Accepted | 28ms | 3120 KiB | ||||
9 | Accepted | 17ms | 3240 KiB | ||||
10 | Accepted | 34ms | 3264 KiB | ||||
11 | Accepted | 28ms | 3128 KiB | ||||
12 | Accepted | 16ms | 3128 KiB | ||||
13 | Accepted | 29ms | 3128 KiB | ||||
subtask3 | 0/19 | ||||||
14 | Accepted | 27ms | 5720 KiB | ||||
15 | Accepted | 414ms | 3204 KiB | ||||
16 | Accepted | 29ms | 5432 KiB | ||||
17 | Accepted | 32ms | 5816 KiB | ||||
18 | Time limit exceeded | 3.085s | 5812 KiB | ||||
19 | Time limit exceeded | 3.099s | 5912 KiB | ||||
20 | Accepted | 16ms | 3128 KiB | ||||
21 | Accepted | 20ms | 4384 KiB | ||||
22 | Accepted | 150ms | 5812 KiB | ||||
23 | Time limit exceeded | 3.029s | 6144 KiB | ||||
24 | Time limit exceeded | 3.085s | 5912 KiB | ||||
25 | Accepted | 57ms | 5912 KiB | ||||
26 | Accepted | 30ms | 3128 KiB | ||||
subtask4 | 0/24 | ||||||
27 | Accepted | 171ms | 33536 KiB | ||||
28 | Time limit exceeded | 3.084s | 3892 KiB | ||||
29 | Time limit exceeded | 3.085s | 34968 KiB | ||||
30 | Time limit exceeded | 3.085s | 35576 KiB | ||||
31 | Time limit exceeded | 3.082s | 35352 KiB | ||||
32 | Time limit exceeded | 3.094s | 35340 KiB | ||||
33 | Accepted | 783ms | 3640 KiB | ||||
34 | Time limit exceeded | 3.101s | 34812 KiB | ||||
35 | Time limit exceeded | 3.088s | 35352 KiB | ||||
36 | Time limit exceeded | 3.089s | 35352 KiB | ||||
37 | Time limit exceeded | 3.088s | 35100 KiB | ||||
38 | Time limit exceeded | 3.101s | 35348 KiB | ||||
39 | Time limit exceeded | 3.085s | 3384 KiB | ||||
subtask5 | 0/22 | ||||||
40 | Accepted | 188ms | 33820 KiB | ||||
41 | Accepted | 488ms | 3128 KiB | ||||
42 | Accepted | 64ms | 13200 KiB | ||||
43 | Accepted | 162ms | 35280 KiB | ||||
44 | Time limit exceeded | 3.091s | 35856 KiB | ||||
45 | Time limit exceeded | 3.088s | 35856 KiB | ||||
46 | Accepted | 17ms | 3132 KiB | ||||
47 | Accepted | 17ms | 3128 KiB | ||||
48 | Accepted | 50ms | 11104 KiB | ||||
49 | Time limit exceeded | 3.089s | 33320 KiB | ||||
50 | Accepted | 1.838s | 35856 KiB | ||||
51 | Time limit exceeded | 3.075s | 35900 KiB | ||||
52 | Accepted | 1.358s | 35852 KiB | ||||
53 | Accepted | 32ms | 3128 KiB | ||||
subtask6 | 0/17 | ||||||
54 | Accepted | 230ms | 45232 KiB | ||||
55 | Time limit exceeded | 3.085s | 45228 KiB | ||||
56 | Accepted | 230ms | 45260 KiB | ||||
57 | Accepted | 194ms | 45140 KiB | ||||
58 | Time limit exceeded | 3.085s | 45272 KiB | ||||
59 | Time limit exceeded | 3.091s | 45260 KiB | ||||
60 | Accepted | 356ms | 45232 KiB | ||||
61 | Accepted | 216ms | 45240 KiB | ||||
62 | Accepted | 212ms | 45272 KiB | ||||
63 | Time limit exceeded | 3.085s | 45040 KiB | ||||
64 | Time limit exceeded | 3.089s | 44908 KiB | ||||
65 | Accepted | 2.203s | 45156 KiB | ||||
66 | Time limit exceeded | 3.101s | 26304 KiB |