#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int main(){
	int n;
	while(cin>>n){
		if(n==0)break;
		int l=0,d=0,m=0;
		int L=0,D=0,M=0;

		rep(i,n){
			int a,b,c;
			char ch;
			cin>>a>>ch>>b>>c;
			if(c<b)c+=60;

			if(11<=a && a<=14){
				L++;
				if(c-b<=8)l++;
			}if(18<=a && a<=20){
				D++;
				if(c-b<=8)d++;

			}if(21<=a && a<=24){
				M++;
				if(c-b<=8)m++;

			}if(0<=a && a<=1){
				M++;
				if(c-b<=8)m++;
			}
		}
		cout<<"lunch ";
		if(L==0)cout<<"no guest"<<endl;
		else cout<<(int)100*l/L<<endl;
		cout<<"dinner ";
		if(D==0)cout<<"no guest"<<endl;
		else cout<<(int)100*d/D<<endl;
		cout<<"midnight ";
		if(M==0)cout<<"no guest"<<endl;
		else cout<<(int)100*m/M<<endl;
	}
}