#ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif #include // #include using namespace std; using ll=long long; using ld=long double; using st=string; using P=pair; // typedef atcoder::modint mint; ll inf=9e18; template constexpr auto max(T... a){return max(initializer_list>{a...});} template constexpr auto min(T... a){return min(initializer_list>{a...});} template auto vec(const ll (&sizes)[s], const T& init = T()){ if constexpr(i < s) return vector(sizes[i], vec(sizes, init)); else return init; } struct segment_tree{ ll size,fn; segment_tree(ll n,ll fnum=0){ ll i=1; while(i(size*2,0); fn=fnum; } void update(ll i,ll n){ if(i>size){ cout<<"size out\n"; } tree[i+size]+=n; _update((i+size)/2); } ll get(ll a,ll b){return _get(a,b,1,0,size);} // [a,b) ll operator[](ll i){return tree[i+size];} private: vector tree; void _update(ll n){ if (n==0) return; tree[n]=f(tree[n*2],tree[n*2+1]); _update(n/2); } ll _get(ll a,ll b,ll k,ll l,ll r){ if (r<=a || b<=l){ return 0; }else if(a<=l && r<=b){ return tree[k]; }else{ ll vl=_get(a,b,k*2,l,(l+r)/2); ll vr=_get(a,b,k*2+1,(l+r)/2,r); return f(vl,vr); } } ll f(ll x,ll y){ if (x==-inf) return y; if (y==-inf) return x; //ここに関数を入力 if(fn==0) return x+y; // if(fn==1) return gcd(x,y); return -1; } }; ll inversion_number(vector &v){ ll n=v.size(); map ma; for(ll i=0;i>q; for(ll i=0;i>s>>t; bool f=0,d=0; auto s_even=vec({26},0); auto s_odd=vec({26},0); auto t_even=vec({26},0); auto t_odd=vec({26},0); auto s_even2=vec({0},0); auto s_odd2=vec({0},0); auto t_even2=vec({0},0); auto t_odd2=vec({0},0); for(ll j=0;j1||s_odd[j]>1) d=1; } f=1; A:; if(f&&d){ cout<<"Yes\n"; }else if(f){ ll x=inversion_number(s_even2)%2; x^=inversion_number(s_odd2)%2; x^=inversion_number(t_even2)%2; x^=inversion_number(t_odd2)%2; if(x==0){ cout<<"Yes\n"; }else{ cout<<"No\n"; } }else{ cout<<"No\n"; } } }