input = """
1 2 2 1 3 4
1 3 2 1 2 4
1 4 0 0
1 2 2 1 5 6
1 5 2 1 2 6
1 6 0 0
1 2 2 1 7 8
1 7 2 1 2 8
1 8 0 0
1 2 2 1 9 10
1 9 2 1 2 10
1 10 0 0
1 2 2 1 11 12
1 11 2 1 2 12
1 12 0 0
1 2 2 1 13 14
1 13 2 1 2 14
1 14 0 0
1 2 2 1 15 16
1 15 2 1 2 16
1 16 0 0
1 2 2 1 17 18
1 17 2 1 2 18
1 18 0 0
1 2 2 1 19 20
1 19 2 1 2 20
1 20 0 0
1 21 2 1 22 23
1 22 2 1 21 23
1 23 0 0
1 21 2 1 24 25
1 24 2 1 21 25
1 25 0 0
1 21 2 1 26 27
1 26 2 1 21 27
1 27 0 0
1 21 2 1 28 29
1 28 2 1 21 29
1 29 0 0
1 21 2 1 30 31
1 30 2 1 21 31
1 31 0 0
1 21 2 1 32 33
1 32 2 1 21 33
1 33 0 0
1 34 2 0 2 21
1 35 2 0 2 21
1 1 2 0 34 35
1 1 2 1 35 34
1 1 2 1 34 35
1 1 2 2 34 35
0
34 a
15 c6
24 e1
32 e5
2 c
9 c3
13 c5
3 d
22 f
30 e4
11 c4
5 c1
21 e
28 e3
35 b
19 c8
17 c7
26 e2
7 c2
0
B+
0
B-
1
0
1
"""
output = """
INCOHERENT
"""
