#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  int64_t q;
  cin >> q;
  while (q--) {
    int64_t n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    map<char, int64_t> S, T;
    vector<char> sorted;
    for (int64_t i = 0; i < n; i++) {
      S[s[i]]++;
      T[t[i]]++;
      sorted.push_back(s[i]);
    }
    if (S != T) {
      cout << "NO\n";
      continue;
    }
    bool yes = false;
    for (char i = 'a'; i <= 'z'; i++)
      if (S[i] > 1 || T[i] > 1) yes = true;
    if (yes) {
      cout << "YES\n";
      continue;
    }
    sort(sorted.begin(), sorted.end());
    int64_t cnt1 = 0, cnt2 = 0;
    for (int64_t i = 0; i < n; i++) {
      if (s[i] != sorted[i]) {
        for (int64_t j = i + 1; j < n; j++)
          if (s[j] == sorted[i]) {
            cnt1 += j - i;
            s = s.substr(0, i) + string(1, sorted[i]) + s.substr(i, j - i) +
                s.substr(j + 1);
            break;
          }
      }
      if (t[i] != sorted[i]) {
        for (int64_t j = i + 1; j < n; j++)
          if (t[j] == sorted[i]) {
            cnt2 += j - i;
            t = t.substr(0, i) + string(1, sorted[i]) + t.substr(i, j - i) +
                t.substr(j + 1);
            break;
          }
      }
    }
    if (cnt1 % 2 == cnt2 % 2)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
