a = []
10.times{
  a.push(gets.to_i)
}

def max_idx(a, i)
  max     = a[i]
  max_idx = i
  (i+1..a.length-1).each{|k|
    if a[k] > max
      max     = a[k]
      max_idx = k
    end
  }
  max_idx
end

(0..a.length-1).each{|i|
  max_idx = max_idx(a, i)
  v = a[i]
  a[i] = a[max_idx]
  a[max_idx] = v
}

(0..2).each{|i|
  puts a[i]
}
  