#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); const int C = 26; int Q; cin >> Q; while (Q--) { string S, T; cin >> S >> T; int N = (int)S.size(); vector> A(2, vector(C)); vector> B(2, vector(C)); for (int i = 0; i < N; i++) { A[i % 2][S[i] - 'a']++; B[i % 2][T[i] - 'a']++; } if (A != B) { cout << "No\n"; continue; } bool ok = (S == T); for (int i = 0; i + 3 < N; i++) { string U = S; swap(U[i], U[i + 2]); swap(U[i + 1], U[i + 3]); if (U == T) ok = true; } cout << (ok ? "Yes" : "No") << '\n'; } return 0; }