#include <bits/stdc++.h>
using namespace std;
int read() {
  int xx = 0, ff = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    xx = xx * 10 + ch - '0';
    ch = getchar();
  }
  return xx * ff;
}
long long READ() {
  long long xx = 0, ff = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    xx = xx * 10 + ch - '0';
    ch = getchar();
  }
  return xx * ff;
}
char one() {
  char ch = getchar();
  while (ch == ' ' || ch == '\n') ch = getchar();
  return ch;
}
const int maxn = 200010;
int N, occa[26], occb[26];
char a[maxn], b[maxn];
int main() {
  for (int _ = read(); _; _--) {
    N = read();
    scanf("%s", a + 1);
    scanf("%s", b + 1);
    memset(occa, 0, sizeof(occa));
    memset(occb, 0, sizeof(occb));
    for (int i = 1; i <= N; i++) occa[a[i] - 'a']++, occb[b[i] - 'a']++;
    bool flag = 1;
    for (int i = 0; i < 26; i++)
      if (occa[i] != occb[i]) flag = 0;
    if (!flag)
      puts("NO");
    else {
      flag = 0;
      for (int i = 0; i < 26; i++)
        if (occa[i] >= 2) flag = 1;
      if (flag)
        puts("YES");
      else {
        int reva = 0, revb = 0;
        for (int i = 1; i <= N; i++)
          for (int j = i + 1; j <= N; j++) {
            if (a[i] > a[j]) reva++;
            if (b[i] > b[j]) revb++;
          }
        if ((reva & 1) == (revb & 1))
          puts("YES");
        else
          puts("NO");
      }
    }
  }
  return 0;
}
