#include <bits/stdc++.h>
using namespace std;
void faster() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  long long q;
  cin >> q;
  while (q--) {
    long long n;
    cin >> n;
    string s, a;
    cin >> s;
    cin >> a;
    s = "." + s;
    a = "." + a;
    long long k[26], k1[26], i, kod, t = 1;
    for (i = 0; i < 26; i++) {
      k[i] = 0;
      k1[i] = 0;
    }
    for (i = 1; i <= n; i++) {
      kod = s[i];
      k[kod - 'a']++;
      kod = a[i];
      k1[kod - 'a']++;
    }
    for (i = 0; i < 26; i++) {
      if (k[i] != k1[i]) {
        t = 0;
        break;
      }
    }
    if (t == 0) {
      cout << "NO" << endl;
      continue;
    }
    for (i = 0; i < 26; i++) {
      if (k[i] > 1) {
        t = 0;
        break;
      }
    }
    if (t == 0) {
      cout << "YES" << endl;
      continue;
    }
    int kk = 0;
    for (int i = 1; i <= n; i++)
      if (s[i] != a[i]) {
        int ps[1231], r = 0;
        for (int j = i + 1; j <= n; j++)
          if (s[j] == a[i]) {
            ps[r] = j;
            r++;
          }
        for (int m = 0; m < r; m++)
          for (int j = ps[m] - 1; j >= i; j--) {
            swap(s[j], s[j + 1]);
            kk++;
          }
      }
    if (kk % 2 == 0)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
