#include<stdio.h>
#include<algorithm>
using namespace std;
int s[3];
int t[3];
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<3;i++)s[i]=t[i]=0;
		for(int i=0;i<a;i++){
			int p,q,r;
			scanf("%d:%d%d",&p,&q,&r);
			if(r<q)r+=60;
			r-=q;
			if(11<=p&&p<=14){
				s[0]++;
				if(r<=8)t[0]++;
			}
			if(18<=p&&p<=20){
				s[1]++;
				if(r<=8)t[1]++;
			}
			if(21<=p||p<2){
				s[2]++;
				if(r<=8)t[2]++;
			}
		}
		printf("lunch ");
		if(!s[0])printf("no guest\n");
		else printf("%d\n",t[0]*100/s[0]);
		printf("dinner ");
		if(!s[1])printf("no guest\n");
		else printf("%d\n",t[1]*100/s[1]);
		printf("midnight ");
		if(!s[2])printf("no guest\n");
		else printf("%d\n",t[2]*100/s[2]);
		
	}
}