#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  vector<char> vs(n), vt(n);
  for (int i = 0; i < n; i++) {
    vs[i] = s[i];
    vt[i] = t[i];
  }
  sort(vs.begin(), vs.end());
  sort(vt.begin(), vt.end());
  for (int i = 0; i < n; i++) {
    if (vs[i] != vt[i]) {
      cout << "NO" << endl;
      return;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (vs[i] == vs[i + 1]) {
      cout << "YES" << endl;
      return;
    }
  }
  int cti['z' - 'a'];
  for (int i = 0; i < n; i++) {
    cti[s[i]] = i;
  }
  int a[n];
  for (int i = 0; i < n; i++) {
    a[i] = cti[t[i]];
  }
  int kol = 0;
  vector<int> num(n, -1);
  for (int i = 0; i < n; i++) {
    if (num[i] == -1) {
      kol++;
      int it = a[i];
      num[i] = kol;
      while (it != i) {
        num[it] = kol;
        it = a[it];
      }
    }
  }
  if ((n + kol) % 2 == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
int main() {
  int q;
  cin >> q;
  while (q--) solve();
  return 0;
}
