#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  map<char, int> ms, mt;
  for (char c : s) ms[c]++;
  for (char c : t) mt[c]++;
  for (auto i : ms)
    if (mt[i.first] != i.second) {
      cout << "NO" << endl;
      return;
    }
  for (auto i : mt)
    if (ms[i.first] != i.second) {
      cout << "NO" << endl;
      return;
    }
  for (auto i : ms)
    if (i.second >= 2) {
      cout << "YES" << endl;
      return;
    }
  int invs = 0, invt = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++) {
      invs += s[i] < s[j];
      invt += t[i] < t[j];
    }
  if (invs % 2 == invt % 2)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
