#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int res[3][2];

int main() {
	int n;
	while(n=in()){
		int a,b,c;
		int i;
		memset(res,0,sizeof(res));
		for(i=0;i<n;i++){
			scanf("%d:%d %d",&a,&b,&c);
//cout<<(c-b+60)%60<<endl;
			if(11<=a&&a<=14){
				res[0][0]++;
				if((c-b+60)%60<=8)res[0][1]++;
			}else if(18<=a&&a<=20){
				res[1][0]++;
				if((c-b+60)%60<=8)res[1][1]++;
			}else if(a<=1||21<=a){
				res[2][0]++;
				if((c-b+60)%60<=8)res[2][1]++;
			}
		}
		cout<<"lunch ";
		if(res[0][0])cout<<res[0][1]*100/res[0][0];
		else cout<<"no guest";
		cout<<endl;
//cout<<res[0][0]<<" "<<res[0][1]<<endl;
		cout<<"dinner ";
		if(res[1][0])cout<<res[1][1]*100/res[1][0];
		else cout<<"no guest";
		cout<<endl;
//cout<<res[1][0]<<" "<<res[1][1]<<endl;
		cout<<"midnight ";
		if(res[2][0])cout<<res[2][1]*100/res[2][0];
		else cout<<"no guest";
		cout<<endl;
//cout<<res[2][0]<<" "<<res[2][1]<<endl;
	}
	return 0;
}