#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <cctype>
using namespace std;
#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

int n;
int main(){
    while(cin >> n && n){
        int lun[2] = {0,0},din[2] = {0,0},mid[2] = {0,0};
        rep(i,n){
            int h,m,M;
            scanf("%d:%d %d",&h,&m,&M);
            int t = M-m;
            if(t < 0) t += 60;
            if(11<= h && h < 15){
                lun[0]++;
                if(t <= 8) lun[1]++;
            }else if(18 <= h && h < 21){
                din[0]++;
                if(t <= 8) din[1]++;
            }else if(21 <= h || (0 <= h && h < 2)){
                mid[0]++;
                if(t <= 8) mid[1]++;
            }
        }

        cout << "lunch ";
        if(lun[0]) cout << 100*lun[1]/lun[0] << endl;
        else cout << "no guest" << endl;
        cout << "dinner ";
        if(din[0]) cout <<  100*din[1]/din[0] << endl;
        else cout << "no guest" << endl;
        cout << "midnight ";
        if(mid[0]) cout << 100*mid[1]/mid[0] << endl;
        else cout << "no guest" << endl;
    }
}