while true
    n = gets.to_i
    break if n == 0
    lines = []
    n.times{lines << gets.chomp.split}
    arr = [[0, 0, "lunch"], [0, 0, "dinner"], [0, 0, "midnight"], [0, 0, "etc"]]
    lines.each{|t, u|
        t1, t2 = t.split(":").map(&:to_i)
        u = u.to_i
        timezone = nil
        if t1.between?(11, 14)
            timezone = 0
        elsif t1.between?(18, 20)
            timezone = 1
        elsif t1.between?(21, 23) || t1.between?(0, 1)
            timezone = 2
        else
            timezone = 3
        end
        arr[timezone][0] += 1

        ok = false
        d = u - t2
        d += 60 if d < 0
        ok = true if d <= 8
        arr[timezone][1] += 1 if ok
    }
    arr[0..-2].each{|item|
        percentage = (item[0] == 0) ? "no guest" : 100 * item[1] / item[0]
        puts "#{item[2]} #{percentage}"
    }
end
