input = """
1 2 2 1 3 4
1 3 2 1 2 4
1 4 0 0
1 5 2 1 6 7
1 6 2 1 5 7
1 7 0 0
1 8 2 1 9 10
1 9 2 1 8 10
1 10 0 0
1 11 2 1 12 13
1 12 2 1 11 13
1 13 0 0
1 14 1 0 2
1 15 1 0 5
1 16 1 0 11
1 17 1 0 2
1 18 1 0 5
1 19 1 0 2
1 20 1 0 5
1 21 1 0 8
1 22 1 0 11
1 20 2 1 18 19
1 23 1 1 17
1 22 1 0 8
1 24 1 1 17
1 25 1 0 21
1 1 2 0 15 21
1 1 2 0 16 15
1 1 1 1 22
1 1 1 1 20
0
12 n_d
18 j
22 n
2 a
8 c
11 d
3 n_a
17 i
21 m
25 r
9 n_c
5 b
24 q
16 h
20 l
23 p
15 f
14 e
19 k
6 n_b
0
B+
0
B-
1
0
1
"""
output = """
{l, n, k, i, a, n_b, e}
"""
