#include <bits/stdc++.h>
#include <windows.h>
#include <conio.h>
using namespace std;
string s[100];
int vis[100];
map<char,int> mp;
set<char> st,gs;
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;i++) cin>>s[i];
for(int i=1;i<=n;i++)
{
for(int j=0;j<s[i].size();j++) st.insert(s[i][j]);
}
system("cls");
for(int i=1;i<=(st.size()+1)/2;i++)
{
system("cls");
cout<<"Guessed: ";
if(gs.size())
for(auto c:gs) cout<<c;
cout<<'\n';
for(int j=1;j<=n;j++)
{
if(vis[j]) cout<<s[j];
else
for(int k=0;k<s[j].size();k++)
{
if(mp[s[j][k]]) cout<<s[j][k];
else cout<<'*';
}
cout<<'\n';
}
char opt;
cout<<"Input option:\n";
opt=_getch();
while(opt!='1'&&opt!='2')
{
system("cls");
cout<<"Input option:\n";
opt=_getch();
}
if(opt=='1')
{
cout<<"Input your guess:\n";
char ch=_getch();
gs.insert(ch);
mp[ch]=1;
if(ch>='a'&&ch<='z')
{
ch+='A'-'a';
gs.insert(ch);
mp[ch]=1;
}
if(ch>='A'&&ch<='Z')
{
ch+='a'-'A';
gs.insert(ch);
mp[ch]=1;
}
}
else
{
cout<<"Input your guess:\n";
int x;
cin>>x;
string str;
cin>>str;
while(x<1||x>n)
{
cout<<"Input your guess:\n";
cin>>x>>str;
}
if(s[x]!=str)
{
cout<<"Wrong"<<'\n';
i++;
_getch();
}
else
{
cout<<"Right"<<'\n';
_getch();
vis[x]=1;
i--;
}
}
for(int j=1;j<=n;j++)
{
if(!vis[j])
{
for(int k=0;k<s[j].size();k++)
{
if(!mp[s[j][k]])
{
goto E;
}
}
cout<<"You failed!";
return 0;
E:;
}
}
for(int j=1;j<=n;j++)
{
if(!vis[j]) goto F;
}
cout<<"You win!";
return 0;
F:;
}
cout<<"You failed!";
return 0;
}