t={}for w in io.read'*a':gfind'%a+'do t[#t+1]=w end table.sort(t)for i,v in next,t do i=v==t[i-1]or v==t[i+1]or io.write(v..' ')end