# Here your code ! t = Array.new(10) t.fill(0) count = 0 a = gets.chomp.to_i a.times do |i| b = gets.chomp.split(" ") b[0..3]= b[0..3].map{|u|u.to_i} if b[4] == "YES" b[0..3].each do |d| t[d]+=1 end count += 1 else b[0..3].each {|d|t[d] = -1} end end puts t.index(count)