def build_pair_list(flat_list):
    paired_list = []
    queue = deque(flat_list)
    while (len(queue) > 0):
        d = queue.pop()
        if ((d.dest in queue) and (d.type != DoorType.SpiralStairs)):
            paired_list.append((d, d.dest))
            queue.remove(d.dest)
        else:
            paired_list.append(d)
    return paired_list
def build_pair_list(flat_list):
    paired_list = []
    queue = deque(flat_list)
    while (len(queue) > 0):
        d = queue.pop()
        if ((d.dest in queue) and (d.type != DoorType.SpiralStairs)):
            paired_list.append((d, d.dest))
            queue.remove(d.dest)
        else:
            paired_list.append(d)
    return paired_list