#include<iostream>
#include<sstream>
#include<iomanip>
#include<stdlib.h>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include<map>
#include<utility>
#include<algorithm>
#include<complex>
using namespace std;
#define loop(i,l,r) for(int (i)=(int)(l);(i)<(int)(r);(i)++)
#define rloop(i,l,r) for(int (i)=(int)(l);(i)>(int)(r);(i)--)
#define rep(i,n) loop(i,0,n)
#define rrep(i,n) rloop(i,n-1,-1)
#define INF 0x3f3f3f3f
#define mod 1000000007LL
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef complex<double> C;

vector<string> split(stringstream& ss){
	string str;
	vector<string> res;
	while(ss>>str)res.push_back(str);
	return res;
}

int main(){
	int n,d[3][2],t[3];
	string s;
	while(1){
		cin>>n;
		if(n==0)break;
		rep(i,3)rep(j,2)d[i][j]=0;
		rep(i,n){
				scanf("%d%*c%d%d",&t[0],&t[1],&t[2]);
				if(t[0]>=11&&t[0]<=14){
						d[0][0]++;
						if((t[2]+60-t[1])%60<=8)d[0][1]++;
				}else if(t[0]>=18&&t[0]<=20){
						d[1][0]++;
						if((t[2]+60-t[1])%60<=8)d[1][1]++;
				}else if((t[0]>=21)||(t[0]>=0&&t[0]<=1)){
						d[2][0]++;
						if((t[2]+60-t[1])%60<=8)d[2][1]++;
				}
		}
		rep(i,3)t[i]=0;
		rep(i,3)if(d[i][0])t[i]=100*(double)d[i][1]/(double)d[i][0];
		cout<<"lunch ";
		if(!d[0][0])cout<<"no guest"<<endl;
		else cout<<t[0]<<endl;
		cout<<"dinner ";
		if(!d[1][0])cout<<"no guest"<<endl;
		else cout<<t[1]<<endl;
		cout<<"midnight ";
		if(!d[2][0])cout<<"no guest"<<endl;
		else cout<<t[2]<<endl;
	}
}