#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b)for(int i=a;i<b;i++)
#define repp(x,arr) for(auto& x:arr)
#define ll long long
#define ull unsigned long long
#define int ll
#define db double
#define pb push_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define mod 1000000007
#define popcount(x) __builtin_popcountll(x)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define nl "\n"
#define PI 3.1415926536 //acos(-1.0)
#define eps 0.00000001
#define mpp make_pair
#define lb lower_bound
#define ub upper_bound
#define PQ priority_queue<int> //by default provide largest element;
#define RS set <ll, greater <ll> >
#define PQS priority_queue<ll,vector<ll>,greater<ll>>
#define ZERO(a) memset(a,0,sizeof(a))
#define inf 0x3f3f3f3f
using vi = vector<int>;
using vii = vector<pii>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
const int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1}; // for every grid problem!!
const int dxn[8]={0,1,1,1,0,-1,-1,-1},dyn[8]={1,1,0,-1,-1,-1,0,1};
template <typename A, typename B> A amax (A &a, B b){ if (b > a) a = b ; return a; }
template <typename A, typename B> A amin (A &a, B b){ if (b < a) a = b ; return a; }
template <typename A, typename B> A mod1 (A &a, B b){ a=(a%b+b)%b ; return a; }
int M[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
bool isleap(int by){return (by%4==0 && (by%100!=0 || by%400==0));};
inline int gcd(int x,int y){return (y==0)?x:gcd(y,x%y);}
inline int mul(int a, int b) { return (int) ((long long) (a%mod * b%mod) % mod);}
inline int add(int a,int b){return (a%mod+b%mod)%mod;}
inline int sub(int a,int b){return (a-b+mod)%mod;}
inline int binpow(int a,int b){
a%=mod;int res=1;
while(b){if(b&1)res=res*a%mod;a=a*a%mod;b/=2;}
return res;
}
inline int inv(int a){return binpow(a,mod-2)%mod;}
struct trie{
trie*child[26];int cnt;
trie(){
rep(i,0,26)child[i]=NULL;
cnt=0;
}
};
void insert(const string&s,trie*root){
trie*node=root;
for(auto ch:s){
int id=(ch-'a');
if(!node->child[id]){
node->child[id]=new trie();
}
node=node->child[id];
node->cnt++;
}
}
void solve(){
int n;cin>>n;
trie*a=new trie();
trie*b=new trie();
for(int i=0;i<n;i++){
string s;cin>>s;insert(s,a);
}
int m;cin>>m;
for(int i=0;i<m;i++){
string s;cin>>s;insert(s,b);
}
function<bool(trie*a1,trie*b1,bool)>dfs=[&](trie*a,trie*b,bool ch){
for(int i=0;i<26;i++){
if(ch){
if(!a->child[i] and b->child[i])return ch;
}else{
if(a->child[i] and !b->child[i])return ch;
}
if(a->child[i] and b->child[i] and dfs(a->child[i],b->child[i],1-ch)==ch)return ch;
}
return !ch;
};
bool ok=dfs(a,b,0);
if(ok)cout<<"Emilija\n";
else cout<<"Nina\n";
}
int32_t main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int T=1;//cin >> T;
while(T--)solve();
return 0;
}
Compilation message (stderr)
Main.cpp: In function 'int32_t main()':
Main.cpp:117:8: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
117 | freopen("input.txt", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:118:8: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
118 | freopen("output.txt", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |