text: 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 8
  1 17 1 0 11
  1 18 1 0 2
  1 19 1 0 5
  1 20 1 0 2
  1 21 1 0 5
  1 22 1 0 8
  1 23 1 0 11
  1 21 2 1 19 20
  1 24 1 1 18
  1 23 1 0 8
  1 25 1 1 18
  1 26 1 0 22
  1 1 2 0 17 15
  1 1 1 1 23
  1 1 1 1 21
  0
  23 n
  12 n_d
  18 i
  22 m
  2 a
  8 c
  11 d
  3 n_a
  17 h
  21 l
  26 r
  25 q
  9 n_c
  5 b
  24 p
  16 g
  20 k
  15 f
  14 e
  19 j
  6 n_b
  0
  B+
  0
  B-
  1
  0
  1
  """
  output = """
  {a, b, c, n_d, e, f, g, i, j, k, l, m, n, r}
  {a, n_b, c, d, e, g, h, i, k, l, m, n, r}
  {a, n_b, c, n_d, e, g, i, k, l, m, n, r}
  {a, n_b, n_c, d, e, h, i, k, l, n}
  {n_a, b, c, n_d, f, g, j, l, m, n, p, q, r}
  """
  