#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    string ss = s, tt = t;
    sort(ss.begin(), ss.end());
    sort(tt.begin(), tt.end());
    if (ss != tt) {
      cout << "NO\n";
      continue;
    }
    bool ok = 0;
    for (int i = 1; i < n; ++i) {
      if (ss[i] == ss[i - 1]) {
        ok = 1;
        break;
      }
    }
    if (ok) {
      cout << "YES\n";
      continue;
    }
    int cnt1 = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n - 1; ++j) {
        if (s[j] > s[j + 1]) {
          swap(s[j], s[j + 1]);
          cnt1++;
        }
      }
    }
    int cnt2 = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n - 1; ++j) {
        if (t[j] > t[j + 1]) {
          swap(t[j], t[j + 1]);
          cnt2++;
        }
      }
    }
    cnt1 &= 1;
    cnt2 &= 1;
    if (cnt1 == cnt2) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
