let rec pair_to_list = function
    Pair(y,z) -> y::(pair_to_list z)
  | x -> [x]