#include <bits/stdc++.h>
using namespace std;
const long long int hell = 1000000007;
const long long int maxn = 1e5 + 5;
bool parity(const string& str) {
  bool res = true;
  for (long long int i = 0; i < str.size(); ++i) {
    for (long long int j = 0; j < i; ++j) {
      if (str[i] < str[j]) res ^= 1;
    }
  }
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int q;
  cin >> q;
  while (q--) {
    long long int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    vector<long long int> f(26, 0);
    bool is = false;
    bool bad = false;
    for (char x : s) f[x - 'a']++;
    for (auto x : f) is |= (x > 1);
    for (char x : t) f[x - 'a']--;
    for (auto x : f)
      if (x != 0) bad = true;
    if (bad) {
      cout << "NO" << '\n';
      continue;
    }
    if (is) {
      cout << "YES" << '\n';
      continue;
    }
    bool inv1 = parity(s);
    bool inv2 = parity(t);
    if (bad)
      cout << "NO" << '\n';
    else {
      if (is or inv1 == inv2)
        cout << "YES" << '\n';
      else
        cout << "NO" << '\n';
    }
  }
}
