out = []

def out.higher?(v)
  return true if self.size < 3
  self.each do |h|
    return true if v > h
  end
  return false
end

def out.push(v)
  if self.size < 3
    self << v
    return
  end
  min = 10000
  min_i = 3
  self.each_with_index do |h, i|
    min, min_i = h, i if min > h
  end
  self[min_i] = v
end

def out.puts_desc
  order = []
  3.times do
    max = 0
    max_i = 3
    self.each_with_index do |h, i|
      max, max_i = h, i if max < h
    end
    order << max
    self.delete_at(max_i)
  end
  order.each do |v|
    puts v
  end
end

10.times do |count|
  num = readline.to_i
  if out.higher? num
    out.push num
  end
end

out.puts_desc