#include<iostream>
#include<string>
using namespace std;
int main()
{
string right, client,end;
end = "#";
int n;
cin >> right;
cin >> n;
int i = 0;
getline(cin, client);
while ((i < n) && (client != end))
{
i++;
getline(cin, client);
if(client==end) return 0;
if (client == right)
{
cout << "Welcome in\n";
return 0;
}
else
cout << "Wrong password: " << client << endl;
}
if(i==2)
return 1;
if (i == n)
cout << "Account locked" << endl;
return 0;
}