#!/usr/local/bin/ruby
num = Hash.new(0)
max = 0
#while (n=gets.to_i) != true
while(n=gets.to_i)!=0
 num[n] += 1
end
num.to_a.sort{|p,q| p[1]<=>q[1]}.reverse.each do |a,b|
 if b >= max
  max = b
  puts a
 else
  break
 end
end