loop do
  n = gets.to_i
  break if n==0
  y = gets.to_i
  max =0
  bs = Hash.new
  bank = Array.new
  n.times do
    b,r,t=gets.split.map(&:to_i)
    bank << b
    bene = 10000 * (t==1 ? (1+y*r/100.0) : (1+r/100.0)**y)
    bs[b]=bene
  end
  puts bank.sort_by{|x|-bs[x]}[0]
end