#include #define fi first #define se second #define rep(i,s,n) for (int i = (s); i < (n); ++i) #define rrep(i,g,n) for (int i = (n)-1; i >= (g); --i) #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() #define len(x) (int)(x).size() #define dup(x,y) (((x)+(y)-1)/(y)) #define pb push_back #define eb emplace_back #define Field(T) vector> using namespace std; using ll = long long; using ull = unsigned long long; template using pq = priority_queue,greater>; using P = pair; templatebool chmax(T&a,T b){if(abool chmin(T&a,T b){if(b> s >> t; int n = len(s); string s0, s1, t0, t1; rep(i,0,n) { if (i%2 == 0) s0 += s[i], t0 += t[i]; else s1 += s[i], t1 += t[i]; } vector cnt0(26), cnt1(26); for (int c : s0) ++cnt0[c-'a']; for (int c : t0) --cnt0[c-'a']; for (int c : s1) ++cnt1[c-'a']; for (int c : t1) --cnt1[c-'a']; rep(i,0,26) { if (cnt0[i] != 0 || cnt1[i] != 0) { cout << "No" << endl; return; } } for (int c : s0) ++cnt0[c-'a']; for (int c : s1) ++cnt1[c-'a']; int x0 = 0, x1 = 0, y0 = 0, y1 = 0; rep(i,0,26) { if (cnt0[i] >= 2) x0 = x1 = 1; if (cnt1[i] >= 2) y0 = y1 = 1; } if (!x0) { int bit = 0; int vs = 0, vt = 0; for (char c : s0) { vs += __builtin_popcount(bit>>(c-'a')); bit |= (1<<(c-'a')); } bit = 0; for (char c : t0) { vt += __builtin_popcount(bit>>(c-'a')); bit |= (1<<(c-'a')); } vs %= 2, vt %= 2; if (vs == vt) x0 = 1; else x1 = 1; } if (!y0) { int bit = 0; int vs = 0, vt = 0; for (char c : s1) { vs += __builtin_popcount(bit>>(c-'a')); bit |= (1<<(c-'a')); } bit = 0; for (char c : t1) { vt += __builtin_popcount(bit>>(c-'a')); bit |= (1<<(c-'a')); } vs %= 2, vt %= 2; if (vs == vt) y0 = 1; else y1 = 1; } if ((x0 && y0) || (x1 && y1)) { cout << "Yes" << endl; } else { cout << "No" << endl; } } int main() { // string s = "abcdefg"; // set st; // queue que; // st.emplace(s); // que.emplace(s); // while(!que.empty()) { // string t = que.front(); // que.pop(); // rep(i,0,len(s)-3) { // swap(t[i], t[i+2]), swap(t[i+1], t[i+3]); // if (!st.contains(t)) { // st.emplace(t); // que.emplace(t); // } // swap(t[i], t[i+2]), swap(t[i+1], t[i+3]); // } // } // for (string t : st) { // cout << t << endl; // } int t; cin >> t; while(t--) solve(); return 0; }