#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long INF = 1e18;
const int M = 1e9 + 7;
const int maxn = 3e5;
char s[maxn], t[maxn];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(10);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n >> s >> t;
    std::vector<int> cs(130), ct(130);
    for (int i = 0; i < n; ++i) {
      ++cs[s[i]];
      ++ct[t[i]];
    }
    auto run = [&]() {
      bool ok = 0;
      for (int i = 'a'; i <= 'z'; ++i) {
        if (cs[i] != ct[i]) {
          cout << "NO" << endl;
          return 0;
        }
        if (cs[i] > 1) {
          ok = 1;
        }
      }
      if (ok) {
        cout << "YES" << endl;
        return 0;
      }
      int tot = 0;
      for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
          if (s[i] > s[j]) {
            ++tot;
          }
          if (t[i] > t[j]) {
            ++tot;
          }
        }
      }
      if (tot & 1) {
        cout << "NO" << endl;
      } else {
        cout << "YES" << endl;
      }
      return 0;
    };
    run();
  }
  return 0;
}
