#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s1, s2;
    int n;
    cin >> n;
    cin >> s1 >> s2;
    auto ss1 = s1, ss2 = s2;
    sort(ss1.begin(), ss1.end());
    sort(ss2.begin(), ss2.end());
    if (ss1 != ss2) {
      cout << "NO\n";
      continue;
    }
    bool flag = false;
    for (int i = 1; i < ss1.size(); i++) {
      if (ss1[i] == ss1[i - 1]) {
        flag = true;
        break;
      }
    }
    if (flag) {
      cout << "YES\n";
      continue;
    }
    long long inv1 = 0, inv2 = 0;
    for (int i = 0; i < s1.size(); i++) {
      for (int j = i + 1; j < s1.size(); j++) {
        if (s1[i] > s1[j]) {
          inv1++;
        }
        if (s2[i] > s2[j]) inv2++;
      }
    }
    cout << ((inv1 % 2) == (inv2 % 2) ? "YES" : "NO") << endl;
  }
  return 0;
}
