import Data.HashTable
 
wGcd x []=[]
wGcd [] x=[]
wGcd lx@(x:xs) ly@(y:ys)
  |elem x ly =x:wGcd xs (delete x ly)
  |elem y xs =y:wGcd (delete y xs) ys
  |otherwise =wGcd xs ys
 
output n a=do
  if(n==1) then putStr$sort a
              else do 
                b<-getLine
                output (n-1) (wGcd a b)
 
main=do
  n<-readLn
  a<-getLine
  output n a