#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
const int mods[10] = {1000000007, 999999937, 999999929, 999999893, 999999883,
                      999999797,  999999761, 999999757, 999999751, 999999739};
const int mod = 1000000007;
int rand_mods[2];
const long double eps = 1e-10;
const int siz = 2e5 + 5, siz2 = (1 << 20) + 5, lg = 21, block = 448,
          block2 = 1000, mxv = 1e5 + 1, sqrt_mod = 31630;
const int alpha_sz = 26;
int q, n, sco[siz], tco[siz];
char s[siz], t[siz];
void clear() {
  memset(sco, 0, sizeof sco);
  memset(tco, 0, sizeof tco);
}
int main() {
  scanf("%d", &q);
  while (q--) {
    scanf("%d%s%s", &n, s, t);
    for (int i = 0; i < n; i++) {
      sco[s[i] - 'a']++;
      tco[t[i] - 'a']++;
    }
    bool done = 0, dup = 0;
    for (int i = 0; i < 26; i++) {
      if (sco[i] != tco[i]) {
        printf("NO\n");
        clear();
        done = 1;
        break;
      }
      if (sco[i] > 1) {
        dup = 1;
      }
    }
    if (done) {
      continue;
    }
    if (dup) {
      printf("YES\n");
      clear();
      continue;
    }
    int swaps = 0;
    for (int i = 0; i < n - 1; i++) {
      int j;
      for (j = i;; j++) {
        if (s[i] == t[j]) {
          break;
        }
      }
      while (j != i) {
        swap(t[j - 1], t[j]);
        j--;
        swaps++;
      }
    }
    printf("%s\n", swaps % 2 ? "NO" : "YES");
    clear();
  }
  return 0;
}
