def ascan; gets.split.map(&:to_i); end

t = gets.to_i.times.map{gets.chomp.count('^')}

h = Hash.new(0)
t.each{|e| h[e]+=1}

p h.to_a.map{|e| [e[1],e[0]]}.max[1]