#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main() {
int M;
cin >> M;
vector<string> guestList;
for (int i = 0; i < M; i++) {
string name;
cin >> name;
guestList.push_back(name);
}
int N;
cin >> N;
vector<string> entered;
for (int i = 0; i < N; i++) {
string arriving;
cin >> arriving;
bool onList = false;
for (int j = 0; j < M; j++) {
if (guestList[j] == arriving) {
onList = true;
break;
}
}
if (!onList) {
cout << "Sorry, not on the list." << endl;
continue;
}
bool alreadyInside = false;
for (int j = 0; j < (int)entered.size(); j++) {
if (entered[j] == arriving) {
alreadyInside = true;
break;
}
}
if (alreadyInside) {
cout << "Already inside!" << endl;
} else {
cout << "Welcome!" << endl;
entered.push_back(arriving);
}
}
return 0;
}