/*
  AOJ 1062
  Title:
  @kankichi573
*/
#include <stdio.h>
#include <string.h>

int denp[3][2];
char timezone[3][9]={"lunch","dinner","midnight"};
void output()
{
  int i;
  for(i=0;i<3;i++)
    {
      printf("%s ",&timezone[i][0]);
      if(denp[i][0]==0)
	printf("no guest\n");
      else
	printf("%d\n",denp[i][1]*100/denp[i][0]);
    }
}


main()
{
  int N;
  int i,ret,hh,mm,MM,z,d;

  while(scanf("%d",&N)  && (N   ))
    {
      memset(denp,0,sizeof(denp));
      for(i=0;i<N;i++)
	{
	  scanf("%d:%d %d",&hh,&mm,&MM);
	  if(hh>=11 && hh<=14)
	    z=0;
	  else if(hh>=18 && hh<=20)
	    z=1;
	  else if(hh>=21 || hh <2)
	    z=2;
	  else
	    z=-1;
	  if(z>=0)
	    {
	      d=MM-mm;
	      if(d<0)
		d+=60;
	      denp[z][0]++;
	      if(d<=8)
		denp[z][1]++;
	    }
	}
      output();
    }
  return(0);
}