def getSPAI bank, year
	1.0 + year * bank[1].to_f / 100
end

def getMPAI bank, year
	(1.0 + bank[1].to_f / 100) ** year
end

def getPAI bank, year
	case bank[2]
	when 1 then
		getSPAI bank, year
	when 2 then
		getMPAI bank, year
	else
		0
	end
end

while (numBank = $stdin.gets.to_i) != 0 do
	year = $stdin.gets.to_i
	max = -1
	ans = -1
	numBank.times do
		bank = $stdin.gets.chomp.split(" ").map(&:to_i)
		pai = getPAI(bank, year)
		if max < pai
			max = pai
			ans = bank[0]
		end
	end
	puts ans
end