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 13 2 1 14 15
1 14 2 1 13 15
1 15 0 0
1 13 2 1 16 17
1 16 2 1 13 17
1 17 0 0
1 13 2 1 18 19
1 18 2 1 13 19
1 19 0 0
1 13 2 1 20 21
1 20 2 1 13 21
1 21 0 0
1 22 2 0 2 13
1 23 2 1 14 2
1 24 2 0 22 23
1 1 3 0 22 23 24
0
13 e
9 c4
18 e2
7 c3
20 e3
2 c
22 a
5 c2
14 f
24 t
3 c1
16 e1
23 b
11 c5
0
B+
0
B-
1
0
1
"""
output = """
{}
"""

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 13 2 1 14 15
1 14 2 1 13 15
1 15 0 0
1 13 2 1 16 17
1 16 2 1 13 17
1 17 0 0
1 13 2 1 18 19
1 18 2 1 13 19
1 19 0 0
1 13 2 1 20 21
1 20 2 1 13 21
1 21 0 0
1 22 2 0 2 13
1 23 2 1 14 2
1 24 2 0 22 23
1 1 3 0 22 23 24
0
13 e
9 c4
18 e2
7 c3
20 e3
2 c
22 a
5 c2
14 f
24 t
3 c1
16 e1
23 b
11 c5
0
B+
0
B-
1
0
1
"""
output = """
{}
"""

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 13 2 1 14 15 1 14 2 1 13 15 1 15 0 0 1 13 2 1 16 17 1 16 2 1 13 17 1 17 0 0 1 13 2 1 18 19 1 18 2 1 13 19 1 19 0 0 1 13 2 1 20 21 1 20 2 1 13 21 1 21 0 0 1 22 2 0 2 13 1 23 2 1 14 2 1 24 2 0 22 23 1 1 3 0 22 23 24 0 13 e 9 c4 18 e2 7 c3 20 e3 2 c 22 a 5 c2 14 f 24 t 3 c1 16 e1 23 b 11 c5 0 B+ 0 B- 1 0 1 {}