#include <bits/stdc++.h>
using namespace std;
int Q, n;
char a[200005], b[200005];
int c[30], d[30];
int bo, ans1, ans2;
int main() {
  scanf("%d", &Q);
  while (Q--) {
    scanf("%d", &n);
    for (int i = 0; i <= n; i++) scanf("%c", &a[i]);
    for (int i = 0; i <= n; i++) scanf("%c", &b[i]);
    memset(c, 0, sizeof(c));
    memset(d, 0, sizeof(d));
    for (int i = 1; i <= n; i++) c[a[i] - 96]++, d[b[i] - 96]++;
    bo = 0;
    for (int i = 1; i <= 26; i++)
      if (c[i] != d[i]) bo = -1;
    if (bo == -1)
      printf("NO\n");
    else {
      for (int i = 1; i <= 26; i++)
        if (c[i] >= 2) bo = 1;
      if (bo == 1)
        printf("YES\n");
      else {
        ans1 = ans2 = 0;
        for (int i = 1; i < n; i++)
          for (int j = i + 1; j <= n; j++) {
            if (a[i] > a[j]) ans1++;
            if (b[i] > b[j]) ans2++;
          }
        if ((ans1 % 2) == (ans2 % 2))
          printf("YES\n");
        else
          printf("NO\n");
      }
    }
  }
  return 0;
}
