#include <bits/stdc++.h>
using namespace std;
int sortstr(string s) {
  int k = 0;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    char c = 'z' + 1;
    int p = 0;
    for (int j = i; j < n; j++)
      if (c > s[j]) {
        c = s[j];
        p = j;
      }
    while (p != i) {
      swap(s[p], s[p - 1]);
      p--;
      k++;
    }
  }
  return k;
}
int main() {
  ios::sync_with_stdio(0);
  int q;
  cin >> q;
  for (int i1 = 0; i1 < q; i1++) {
    int n;
    cin >> n;
    string s, t;
    cin >> s;
    cin >> t;
    vector<int> a(26, 0), b(26, 0);
    for (int i = 0; i < n; i++) {
      a[s[i] - 'a']++;
      b[t[i] - 'a']++;
    }
    bool o = true;
    for (int i = 0; i < 26; i++)
      if (a[i] != b[i]) {
        o = false;
        break;
      }
    if (!o) {
      cout << "NO" << endl;
      continue;
    }
    for (int i = 0; i < 26; i++)
      if (a[i] > 1) o = false;
    if (!o) {
      cout << "YES" << endl;
      continue;
    }
    if (sortstr(s) % 2 != sortstr(t) % 2)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
}
