#include<stdio.h>
#include<string.h>
int main()
{
	int n,A,B,C,D,E,F,G,H,i;
	A=11*60;
	B=14*60+59;
	C=18*60;
	D=20*60+59;
    E=21*60;
	F=23*60+59;
	G=0;
	H=1*60+59;
	while(scanf("%d",&n)!=EOF&&n)
	{
		int L,l,DI,di,M,m,sum,sum1,a,b,c;
		L=l=DI=di=M=m=sum=sum1=0;
		for(i=0;i<n;i++)
		{
			scanf("%d%*c%d%d",&a,&b,&c);
			sum=(a*60+b)%(24*60);
			if(c<b)
				sum1=((a+1)*60+c)%(24*60);
			else
				sum1=(a*60+c)%(24*60);
			if(sum>=A&&sum<=B&&sum1>=A&&sum1<=B)
			{
				L++;
				if(sum1-sum<=8)
					l++;
				continue;
			}
			if(sum>=C&&sum<=D&&sum1>=C&&sum1<=D)
			{
				DI++;
				if(sum1-sum<=8)
					di++;
				continue;
			}
			if(sum>=E&&sum<=F&&sum1>=E&&sum1<=F)
			{
				M++;
				if(sum1-sum<=8)
					m++;
				continue;
			}
			if(sum>=G&&sum<=H&&sum1>=G&&sum1<=H)
			{
				M++;
				if(sum1-sum<=8)
					m++;
				continue;
			}
			if(sum>=E&&sum<=F&&sum1>=G&&sum1<=H)
			{
				M++;
				if(sum1-sum<=8)
					m++;
				continue;
			}
			if(L==0)
				printf("lunch no guest\n");
			else
				printf("lunch %.0lf\n",(l*1.0/L)*100);
			if(DI==0)
				printf("dinner no guest\n");
			else
				printf("dinner %.0lf\n",(di*1.0/DI)*100);
			if(M==0)
				printf("midnight no guest\n");
			else
				printf("midnight %.0lf\n",(m*1.0/M)*100);
		}
		
	}
	return 0;
}