#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(C), B(C); for (char c : S) A[c - 'a']++; for (char c : T) B[c - 'a']++; if (A != B) { cout << "No\n"; continue; } int x = 0, y = 0; for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { x ^= (S[i] > S[j]); y ^= (T[i] > T[j]); } } cout << (x == y ? "Yes" : "No") << '\n'; } return 0; }