text: #Problem        : Birthday Cake
  #Language       : Python 3
  #Compiled Using : py_compile
  #Version        : Python 3.4.3
  #Input for your program will be provided from STDIN
  #Print out all output from your program to STDOUT
  
  import sys
  
  data = sys.stdin.read().splitlines()
  
  n = int(data[0])
  
  a = data[1:]
  
  st = set()
  vt = []
  
  
  
  
  