def solve(times)
  ok, ng = [0] * 3, [0] * 3
  times.each do |t|
    a, b = t.split
    h = a.split(':')[0].to_i
    m = (b.to_i - a.split(':')[1].to_i + 60) % 60
    if 11 <= h && h <= 14
      m > 8 ? ng[0] += 1 : ok[0] += 1
    elsif 18 <= h && h <= 20
      m > 8 ? ng[1] += 1 : ok[1] += 1
    elsif 0 <= h && h < 2 || 21 <= h && h <= 23
      m > 8 ? ng[2] += 1 : ok[2] += 1
    end
  end
  [ok, ng]
end

while n = gets.to_i
  break if n == 0
  ok, ng = solve(n.times.map{ gets.chomp })
  sum = ok.zip(ng).map{ |t| t.reduce(:+) }
  dish = ['lunch ', 'dinner ', 'midnight ']
  3.times do |i|
    puts dish[i] + (sum[i] == 0 ? 'no guest' : (ok[i] * 100 / sum[i]).to_s)
  end
end