#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>                        
using namespace std;
const int N=51;
char email[N],name[N],pwd[N],e[N];
int main() 
{
	gets(email);
	int n, s=0;
	cin >> n;
	for (int i=0; i<n; i++)
	{
		cin >> name >> pwd >> e;
		if (strcmp(email, e) == 0)
		{
			s++;
			cout << name << " ";
			for (int j=0; pwd[j]!='\0'; j++)
			{
				if (pwd[j]>='a' && pwd[j]<='z')
					cout << char(pwd[j]-32);
				else if (pwd[j]>='A' && pwd[j]<='Z')
					cout << char(pwd[j]+32);
				else
					cout << pwd[j];
			}
			cout << endl;
		}
	}
	if (s == 0)
		cout << "empty" << endl;
		
	return 0;	
} 

暂未启用评论功能。