# 讀取輸入
import sys
input = sys.stdin.read
data = input().strip().split('\n')
# 解析輸入
n = int(data[0])
registrations = [line.split() for line in data[1:n+1]]
# 用來儲存已經註冊過的Gmail地址
registered_gmails = set()
# 處理每個註冊操作
for email, username in registrations:
if email in registered_gmails:
print(f"{username} account has been used")
else:
registered_gmails.add(email)
print(f"welcome, {username}")