while true
    n = gets.to_i
    break if n == 0

    arr, arr2 = [], Array.new(31, 0)
    n.times{
        line = gets.chomp.split
        arr << [line[0], line[2..-1].map(&:to_i), 0]
        arr.last[1].each{|t| arr2[t] += 1}
    }
    arr.each{|character| character[1].each{|t| character[2] += (n - arr2[t] + 1)}}
    arr.sort_by!{|name, ar, p| [p, name]}
    puts "#{arr[0][2]} #{arr[0][0]}"
end
