#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using TP = tuple<ll, ll, ll>;
void init_io() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
int mergecount(vector<int> &a) {
  int count = 0;
  int n = a.size();
  if (n > 1) {
    vector<int> b(a.begin(), a.begin() + n / 2);
    vector<int> c(a.begin() + n / 2, a.end());
    count += mergecount(b);
    count += mergecount(c);
    for (int i = 0, j = 0, k = 0; i < n; ++i)
      if (k == c.size())
        a[i] = b[j++];
      else if (j == b.size())
        a[i] = c[k++];
      else if (b[j] <= c[k])
        a[i] = b[j++];
      else {
        a[i] = c[k++];
        count += n / 2 - j;
      }
  }
  return count;
}
void solve() {
  ll n, alen, blen;
  string s, t, cs, ct;
  vector<int> a, b;
  bool can = false;
  vector<ll> v(26, 0), cv(26, 0);
  cin >> n >> s >> t;
  for (auto c : s) {
    a.push_back(c - 'a');
    v[c - 'a']++;
    if (v[c - 'a'] >= 2) {
      can = true;
    }
  }
  for (auto c : t) {
    b.push_back(c - 'a');
    cv[c - 'a']++;
    if (cv[c - 'a'] >= 2) {
      can = true;
    }
  }
  cs = s;
  ct = t;
  sort(cs.begin(), cs.end());
  sort(ct.begin(), ct.end());
  if (cs != ct) {
    cout << "NO\n";
    return;
  }
  alen = mergecount(a);
  blen = mergecount(b);
  if (can || (alen % 2 == blen % 2)) {
    cout << "YES\n";
  } else {
    cout << "NO\n";
  }
}
signed main() {
  init_io();
  ll t;
  cin >> t;
  while (t--) solve();
}
