input = """
1 2 1 1 3
1 3 1 1 2
1 4 1 1 5
1 5 1 1 4
1 6 1 1 7
1 7 1 1 6
1 8 1 1 9
1 9 1 1 8
1 10 1 1 11
1 11 1 1 10
1 12 1 1 13
1 13 1 1 12
1 1 2 0 2 4
1 1 2 1 4 2
1 1 2 1 2 4
1 1 2 2 2 4
1 1 2 0 2 6
1 1 2 1 6 2
1 1 2 1 2 6
1 1 2 2 2 6
1 1 2 0 10 12
1 1 2 1 12 10
1 1 2 1 10 12
1 1 2 2 10 12
0
8 d
6 c
11 ne
5 nb
12 f
2 a
13 nf
4 b
9 nd
3 na
10 e
7 nc
0
B+
0
B-
1
0
1
"""
output = """
INCOHERENT
"""

input = """
1 2 1 1 3
1 3 1 1 2
1 4 1 1 5
1 5 1 1 4
1 6 1 1 7
1 7 1 1 6
1 8 1 1 9
1 9 1 1 8
1 10 1 1 11
1 11 1 1 10
1 12 1 1 13
1 13 1 1 12
1 1 2 0 2 4
1 1 2 1 4 2
1 1 2 1 2 4
1 1 2 2 2 4
1 1 2 0 2 6
1 1 2 1 6 2
1 1 2 1 2 6
1 1 2 2 2 6
1 1 2 0 10 12
1 1 2 1 12 10
1 1 2 1 10 12
1 1 2 2 10 12
0
8 d
6 c
11 ne
5 nb
12 f
2 a
13 nf
4 b
9 nd
3 na
10 e
7 nc
0
B+
0
B-
1
0
1
"""
output = """
INCOHERENT
"""

1 2 1 1 3 1 3 1 1 2 1 4 1 1 5 1 5 1 1 4 1 6 1 1 7 1 7 1 1 6 1 8 1 1 9 1 9 1 1 8 1 10 1 1 11 1 11 1 1 10 1 12 1 1 13 1 13 1 1 12 1 1 2 0 2 4 1 1 2 1 4 2 1 1 2 1 2 4 1 1 2 2 2 4 1 1 2 0 2 6 1 1 2 1 6 2 1 1 2 1 2 6 1 1 2 2 2 6 1 1 2 0 10 12 1 1 2 1 12 10 1 1 2 1 10 12 1 1 2 2 10 12 0 8 d 6 c 11 ne 5 nb 12 f 2 a 13 nf 4 b 9 nd 3 na 10 e 7 nc 0 B+ 0 B- 1 0 1 INCOHERENT