#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
 
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;

void fin(){
	freopen("test.txt", "r", stdin);
}

int check(int m, int M){
	if(M<m)M+=60;
	return M-m<=8;
}

int getper(vector<int> v){
	int cnt = 0;
	rep(i, v.size()){
		cnt += v[i];
	}
	return cnt*100/v.size();
}

int main(){
	int n;
	while(cin >> n, n){
		vector<int> guest[3];
		rep(i, n){
			int h, m, m2;
			char c;
			cin >> h >> c >> m >> m2;
			if(h >= 11 && h < 15)guest[0].push_back(check(m,m2));
			else if(h >= 18 && h < 21) guest[1].push_back(check(m,m2));
			else if(h < 2 || (h >= 21 && h <= 24))guest[2].push_back(check(m,m2));
		}
		int cnt = 0;
		string str[3] = {"lunch", "dinner", "midnight"};
		rep(i, 3){
			cout << str[i] << ' ';
			if(guest[i].size() == 0) cout << "no guest" << endl;
			else cout << getper(guest[i]) << endl;
		}
	}

	return 0;
}