#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return {i, j};
}
struct printer {
  ~printer() { cerr << endl; }
  template <class c>
  printer& operator,(c x) {
    cerr << boolalpha << x;
    return *this;
  }
  printer& operator,(string x) {
    cerr << x;
    return *this;
  }
  template <class c, class d>
  printer& operator,(pair<c, d> x) {
    return *this, "(", x.first, ", ", x.second, ")";
  }
  template <class... d, template <class...> class c>
  printer& operator,(c<d...> x) {
    return *this, range(begin(x), end(x));
  }
  template <class c>
  printer& operator,(rge<c> x) {
    *this, "[";
    for (auto it = x.b; it != x.e; ++it) *this, (it == x.b ? "" : ", "), *it;
    return *this, "]";
  }
};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int my_rand(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); }
const int N = 100009;
int ar[130], br[130];
int main() {
  string s, s1, s2;
  int t, n, i, j;
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> s1 >> s2;
    for (i = 'a'; i <= 'z'; i++) ar[i] = br[i] = 0;
    for (i = 0; i < n; i++) {
      ar[s1[i]]++;
      br[s2[i]]++;
    }
    int flag = 1, dual = 0;
    for (i = 'a'; i <= 'z' && flag; i++) {
      if (ar[i] != br[i]) flag = 0;
      if (ar[i] >= 2) dual = 1;
    }
    if (flag) {
      int cnt1 = 0, cnt2 = 0;
      if (dual)
        cout << "YES" << '\n';
      else {
        s = s1;
        sort(s.begin(), s.end());
        for (i = 0; i < n; i++) {
          for (j = i; j < n; j++) {
            if (s2[j] == s[i]) break;
          }
          while (j != i) {
            swap(s2[j], s2[j - 1]);
            cnt2++;
            j--;
          }
          for (j = i; j < n; j++) {
            if (s1[j] == s[i]) break;
          }
          while (j != i) {
            swap(s1[j], s1[j - 1]);
            cnt1++;
            j--;
          }
        }
        if (cnt1 % 2 == cnt2 % 2)
          cout << "YES" << '\n';
        else
          cout << "NO" << '\n';
      }
    } else
      cout << "NO" << '\n';
  }
  return 0;
}
