#if defined(__GNUC__) && !defined(__clang__) #pragma GCC optimize("O3") #if defined(__x86_64__) || defined(__i386__) #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #endif #endif #include #include #define each(x, v) for (auto&& x : v) #define each2(x, y, v) for (auto&& [x, y] : v) #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) #define all(x) begin(x),end(x) #define sz(x) (int)(x).size() using namespace std; using namespace atcoder; using ll=long long; using ull=unsigned long long; using ld=long double; using vll=vector; using vvll=vector; using vi=vector; using vvi=vector; using pll=pair; using pi=pair; // using mint=modint998244353; // using mint=modint1000000007; // using mint2=static_modint<2>; // using mint=LazyMontgomeryModInt<998244353>; // using vm=vector; // using vvm=vector; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); static ull w[1000000][26]; rep(i,0,1000000)rep(j,0,26)w[i][j]=rng(); unordered_setD; rep(i,0,N){ string s; cin>>s; ull h=0; rep(i,0,sz(s))h^=w[i][s[i]-'a']; if(D.find(h)!=D.end()){ cout<<"Yes\n"; }else{ bool no=true; rep(i,1,sz(s)){ auto a=s[i-1]-'a',b=s[i]-'a'; ull nh=h^w[i-1][a]^w[i][b]^w[i-1][b]^w[i][a]; if(D.find(nh)!=D.end()){ no=false; cout<<"Yes\n"; break; } } if(no)cout<<"No\n"; } D.insert(h); } }