#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int inf = 0x3f3f3f3f;
char a[maxn], b[maxn], aa[maxn], bb[maxn];
int main() {
  int t, n;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    scanf("%s", a + 1);
    scanf("%s", b + 1);
    strcpy(aa + 1, a + 1);
    strcpy(bb + 1, b + 1);
    sort(aa + 1, aa + n + 1);
    sort(bb + 1, bb + n + 1);
    int ju = 0;
    for (int i = 1; i <= n; ++i)
      if (aa[i] != bb[i]) {
        ju = 1;
        break;
      }
    if (ju) {
      printf("NO\n");
      continue;
    }
    for (int i = 1; i < n; ++i)
      if (aa[i] == aa[i + 1] || bb[i] == bb[i + 1]) {
        ju = 1;
        break;
      }
    if (ju) {
      printf("YES\n");
      continue;
    }
    int ans1 = 0;
    for (int i = n; i > 1; --i)
      for (int j = 1; j < i; ++j)
        if (a[j] > a[j + 1]) {
          ++ans1;
          swap(a[j], a[j + 1]);
        }
    int ans2 = 0;
    for (int i = n; i > 1; --i)
      for (int j = 1; j < i; ++j)
        if (b[j] > b[j + 1]) {
          ++ans2;
          swap(b[j], b[j + 1]);
        }
    if (abs(ans1 - ans2) % 2 == 0)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
