import std.stdio;
import std.string;
import std.conv;

void main(){
    int n;
    while(true){
        int allLunch, allDinner, allMidnight;
        int lunch, dinner, midnight;
        n = readln().chomp().to!int();
        if(n == 0){
            break;
        }
        foreach(i; 0..n){
            auto input = readln().chomp().split(":");
            int h = input[0].to!int();
            if(h < 11){
                h += 24;
            }
            input = input[1].split();
            int m = input[0].to!int();
            int m2 = input[1].to!int();
            int diff = m < m2 ? m2 - m : 60 - m + m2;

            if(11 <= h && h <= 14){
                ++allLunch;
                if(diff <= 8){
                    ++lunch;
                }
            }else if(18 <= h && h <= 20){
                ++allDinner;
                if(diff <= 8){
                    ++dinner;
                }
            }else if(21 <= h && h <= 25){
                ++allMidnight;
                if(diff <= 8){
                    ++midnight;
                }
            }
        }
        if(allLunch){
            writeln("lunch ", 100 * lunch / allLunch);
        }else{
            writeln("lunch no guest");
        }
        if(allDinner){
            writeln("dinner ", 100 * dinner  / allDinner);
        }else{
            writeln("dinner no guest");
        }
        if(allMidnight){
            writeln("midnight ", 100 * midnight / allMidnight);
        }else{
            writeln("midnight no guest");
        }
    }
}