#t193. 紧急措施

紧急措施

Emergency Measures

Problem Description

Recently, some popular websites were hacked, and the account, password, and email data of these sites was leaked. You registered several accounts on these sites (possibly under different usernames), but you used the same email when registering. Now that you have obtained the leaked data, you want to change your passwords as soon as possible. The strategy is: find your username and password by your email, then change the password. The rule for changing a password is: swap lowercase and uppercase letters, while leaving non-alphabetic characters unchanged.

Input Format

The first line is your email address, at most 5050 characters long and containing only letters, digits, and the @ symbol.

The second line is the number of accounts NN (0<N<100000 < N < 10000).

The following NN lines each describe one account in the format:

username password email

The three fields are separated by a single space. The username, password, and email contain no spaces and are each at most 5050 characters long.

Output Format

Output several lines, one for each of your accounts, each containing: your username, followed by the changed password (separated by a single space).

If none of the accounts is yours, output empty.

Sample Input 1

abc@pku.edu.cn
5
helloKitty iLoveCats abc@pku.edu.cn
2012 maya2012 cplusplus@exam.com
KittyCat 5iKitty abc@pku.edu.cn
program password teacher@exam.com
whoAmi Feb.29$ abc@pku.edu.cn

Sample Output 1

helloKitty IlOVEcATS
KittyCat 5IkITTY
whoAmi fEB.29$

Sample Input 2

abc@pku.edu.cn
1
2012 maya2012 cplusplus@exam.com

Sample Output 2

empty