#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long q;
  cin >> q;
  while (q--) {
    long long n;
    string s, t;
    cin >> n >> s >> t;
    vector<long long> cnt1(26), cnt2(26);
    for (auto i : s) cnt1[i - 'a']++;
    for (auto i : t) cnt2[i - 'a']++;
    bool ok = true;
    for (long long i = 0; i < 26; i++) ok &= (cnt1[i] == cnt2[i]);
    if (!ok) {
      cout << "NO" << '\n';
      continue;
    }
    ok = false;
    for (long long i = 0; i < 26; i++)
      if (cnt1[i]) ok |= (cnt1[i] >= 2);
    if (ok)
      cout << "YES" << '\n';
    else {
      long long inv1 = 0, inv2 = 0;
      for (long long i = 0; i < n; i++)
        for (long long j = i + 1; j < n; j++) {
          if (s[i] > s[j]) inv1++;
          if (t[i] > t[j]) inv2++;
        }
      if (inv1 % 2 == inv2 % 2)
        cout << "YES" << '\n';
      else
        cout << "NO" << '\n';
    }
  }
  return 0;
}
