#include <bits/stdc++.h>
using namespace std;
using lld = long long;
bool ok(string a, string b) {
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  return (a == b);
}
int inv(string a) {
  int res = 0;
  for (int i = 0; i < a.length(); i++)
    for (int j = i + 1; j < a.length(); j++) res += (a[i] < a[j] ? 1 : 0);
  return res;
}
bool par(string a) {
  vector<int> cnt(26, 0);
  for (char c : a) cnt[c - 'a']++;
  for (int i : cnt)
    if (i > 1) return true;
  return false;
}
void query(void) {
  int n;
  string a, b;
  cin >> n >> a >> b;
  if (!ok(a, b)) {
    cout << "NO\n";
    return;
  }
  if (par(a))
    cout << "YES\n";
  else
    cout << (inv(a) % 2 == inv(b) % 2 ? "YES" : "NO") << "\n";
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q;
  cin >> q;
  while (q--) query();
  return 0;
}
