#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	while(scanf("%d",&n)&&n)
	{
		int hh,mm,MM,lunchsum=0,dinnersum=0,midnightsum=0,lunch=0,dinner=0,midnight=0;
		int i;
		for(i=1;i<=n;i++)
		{
			scanf("%d%*c%d%d",&hh, &mm, &MM);
			if(hh>=11&&hh<=14)
			{
				lunchsum++;
				if((MM>mm&&MM-mm<=8)||(MM<mm&&MM+60-mm<=8))
				{
					lunch++;
				}
			}
			else if(hh>=18&&hh<=20)
			{
				dinnersum++;
				if((MM>mm&&MM-mm<=8)||(MM<mm&&MM+60-mm<=8))
				{
					dinner++;
				}
			}
			else if(hh<=1&&hh>=21)
			{
				midnightsum++;
				if((MM>mm&&MM-mm<=8)||(MM<mm&&MM+60-mm<=8))
				{
					midnight++;
				}
			}
		}
		printf("lunch ");
		if(lunchsum==0)
		{
			printf("no guest\n");
		}
		else
		{
			printf("%d\n",(int)(1.0*lunch/lunchsum*100));
		}
		printf("dinner ");
		if(dinnersum==0)
		{
			printf("no guest\n");
		}
		else
		{
			printf("%d\n",(int)(1.0*dinner/dinnersum*100));
		}
		printf("midnight ");
		if(midnightsum==0)
		{
			printf("no guest\n");
		}
		else
		{
			printf("%d\n",(int)(1.0*midnight/midnightsum*100));
		}

	}




	return 0;
}