#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
signed main() {
ios_base::sync_with_stdio(0); cin.tie(0);
int M; cin >> M;
unordered_set<string> st;
for (int i = 0; i < M; i++) {
string name; cin >> name;
st.insert(name);
}
unordered_set<string> temp;
int n; cin >> n;
while (n--) {
string person; cin >> person;
if (st.find(person) == st.end()) cout << "Sorry, not on the list.\n";
else if (temp.find(person) != temp.end()) cout << "Already inside!\n";
else {
cout << "Welcome!\n";
temp.insert(person);
}
}
}