#include <bits/stdc++.h>
using namespace std;
int a[400001];
int b[400001];
int n;
int ans = 0;
void merge(int l, int r) {
  if (l == r) {
    return;
  }
  int mid = (l + r) >> 1;
  merge(l, mid);
  merge(mid + 1, r);
  int i = l;
  int j = mid + 1;
  int now = l;
  while (i <= mid && j <= r) {
    if (a[i] > a[j]) {
      b[now++] = a[j++];
      ans += mid - i + 1;
    } else {
      b[now++] = a[i++];
    }
  }
  while (j <= r) {
    b[now++] = a[j++];
  }
  while (i <= mid) {
    b[now++] = a[i++];
  }
  for (int i = l; i <= r; i++) a[i] = b[i];
  return;
}
int t1[27];
int t2[27];
int a1[200001];
int a2[200001];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    memset(t1, 0, sizeof(t1));
    memset(t2, 0, sizeof(t2));
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      char c;
      c = getchar();
      while (c > 'z' || c < 'a') c = getchar();
      a1[i] = c - 'a' + 1;
      t1[a1[i]]++;
    }
    for (int i = 1; i <= n; i++) {
      char c;
      c = getchar();
      while (c > 'z' || c < 'a') c = getchar();
      a2[i] = c - 'a' + 1;
      t2[a2[i]]++;
    }
    bool f = 0;
    bool flag = 0;
    for (int i = 1; i <= 26; i++) {
      if (t1[i] > 1) f = 1;
      if (t1[i] != t2[i]) {
        puts("NO");
        flag = 1;
        break;
      }
    }
    if (flag) continue;
    if (f == 1) {
      puts("YES");
      continue;
    }
    ans = 0;
    for (int i = 1; i <= n; i++) a[i] = a1[i];
    merge(1, n);
    int ans1 = ans;
    ans = 0;
    for (int i = 1; i <= n; i++) a[i] = a2[i];
    merge(1, n);
    if (abs(ans - ans1) % 2 == 1)
      puts("NO");
    else
      puts("YES");
  }
}
