<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def print_tree(graph, tails, node_id_map):
 """Print out a tree of blocks starting from the common ancestor."""

    # Example:
    # |
    # | 5
    # *  a {0, 1, 2, 3, 4}
    # |
    # | 6
    # |\
    # * |  b {0, 1, 2, 3}
    # | *  n {4}
    # | |
    # | | 7
    # * |  c {0, 1, 2, 3}
    # | *  o {4}
    # | |
    # | | 8
    # |\ \
    # * | |  i {2, 3}
    # | * |  d {0, 1}
    # | | *  p {4}
    # | | |
    # | | | 9
    # * | |  j {2, 3}
    # | * |  e {0, 1}
    # | | *  q {4}
    # | | |
    # | | | 10
    # * | |  k {2, 3}
    # | * |  f {0, 1}
    # | | *  r {4}
    # | | |
    # | | | 11
    # |\ \ \
    # | | |\ \
    # * | | | |    g {0}
    # | * | | |    h {1}
    # |   * | |    l {2}
    # |   | * |    m {3}
    # |   |   *    s {4}
    # |  /   /
    # | |  /
    # | | | 12
    # * | |   t {0}
    # | * |   u {2}
    # | | *   v {4}
    # | |
    # | | 13
    # * |   w {0}
    # | *   x {2}
    # |
    # | 14
    # *   y {0}
    # | 15
    # *   z {0}

    walker = graph.walk()
    next_block_num, next_parent, next_siblings = next(walker)
    prev_cliques = []

    done = False
    while not done:
        cliques = {}
        block_num = next_block_num

        # Read all the cliques for this block number
        try:
            while block_num == next_block_num:
                cliques[next_parent] = next_siblings
                next_block_num, next_parent, next_siblings = next(walker)
        except StopIteration:
            # Do one last iteration after we've consumed the entire graph
            done = True

        print_cliques(prev_cliques, cliques, node_id_map)

        print_block_num_row(block_num, prev_cliques, cliques)

        print_splits(prev_cliques, cliques)

        print_folds(prev_cliques, cliques)

        prev_cliques = build_ordered_cliques(prev_cliques, cliques)

    print_cliques(prev_cliques, [], node_id_map)