#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, n) for (int i = (int)(n) - 1; i >= 0; i--) #define repk(i, k, n) for (int i = k; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define mod1 1000000007 #define mod2 998244353 #define vi vector<int> #define vs vector<string> #define vc vector<char> #define vl vector<ll> #define vvi vector<vector<int>> #define vvc vector<vector<char>> #define vvl vector<vector<ll>> #define vvvi vector<vector<vector<int>>> #define vvvl vector<vector<vector<ll>>> #define pii pair<int,int> #define pil pair<int,ll> #define pli pair<ll, int> #define pll pair<ll, ll> #define vpii vector<pair<int,int>> #define vpll vector<pair<ll,ll>> #define vvpii vector<vector<pair<int,int>>> #define vvpll vector<vector<pair<ll,ll>>> template<typename T> void debug(T e){ cerr << e << endl; } template<typename T> void debug(vector<T> &v){ rep(i, v.size()){ cerr << v[i] << " "; } cerr << endl; } template<typename T> void debug(vector<vector<T>> &v){ rep(i, v.size()){ rep(j, v[i].size()){ cerr << v[i][j] << " "; } cerr << endl; } } template<typename T> void debug(vector<pair<T, T>> &v){ rep(i,v.size()){ cerr << v[i].first << " " << v[i].second << endl; } } template<typename T> void debug(set<T> &st){ for (auto itr = st.begin(); itr != st.end(); itr++){ cerr << *itr << " "; } cerr << endl; } template<typename T> void debug(multiset<T> &ms){ for (auto itr = ms.begin(); itr != ms.end(); itr++){ cerr << *itr << " "; } cerr << endl; } template<typename T> void debug(map<T, T> &mp){ for (auto itr = mp.begin(); itr != mp.end(); itr++){ cerr << itr->first << " " << itr->second << endl; } } void debug_out(){ cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T){ cerr << H << " "; debug_out(T...); } ll mk_hash(string S, ll h, ll mod){ ll num = 1; ll ret = 0; for (ll i = 0; i < S.size(); i++){ ret = (ret * h) % mod; ret = (ret + (S[i] - 'a')) % mod; } return ret; } ll to_single_val(ll hashs, ll len){ return hashs * 1000000 + len; } int main(){ int N; cin >> N; vs S(N); unordered_map<ll, ll> mp; rep(i,N) cin >> S[i]; ll h1 = 1000; for (ll i = 0; i < N; i++){ ll hashs = mk_hash(S[i], h1, mod1); //debug(hashs); //mp[to_single_val(hashs, len)]++; //mp[pll(hashs, S[i].size())]++; } vl pows(1000002); pows[0] = 1; for (ll i = 0; i < 1000001; i++){ pows[i + 1] = (pows[i] * h1) % mod1; } for (ll i = 0; i < N; i++){ bool pos = false; ll hashs = mk_hash(S[i], h1, mod1); if (mp[to_single_val(hashs, S[i].size())]){ pos = true; } ll len = S[i].size(); for (ll j = 0; j < len - 1; j++){ ll new_hash = hashs; new_hash = (new_hash - ((ll)(S[i][j] - 'a') * pows[len - 1 - j]) % mod1 + mod1) % mod1; new_hash = (new_hash + ((ll)(S[i][j + 1] - 'a') * pows[len - 1 - j]) % mod1 + mod1) % mod1; new_hash = (new_hash - ((ll)(S[i][j + 1] - 'a') * pows[len - 1 - (j + 1)]) % mod1 + mod1) % mod1; new_hash = (new_hash + ((ll)(S[i][j] - 'a') * pows[len - 1 - (j + 1)]) % mod1 + mod1) % mod1; //debug(new_hash); if (mp[to_single_val(new_hash, S[i].size())]){ pos = true; } /*if (mp[pll(new_hash, S[i].size())]){ pos = true; }*/ } if (pos) cout << "Yes" << endl; else cout << "No" << endl; mp[to_single_val(hashs, S[i].size())]++; } }