#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
char s[N], t[N];
int q, n, cnt[30], cnt2[30];
int solve(char *s) {
  int res = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < i; j++)
      if (s[j] > s[i]) res++;
  return res;
}
int main() {
  scanf("%d", &q);
  while (q--) {
    memset(cnt, 0, sizeof(cnt));
    memset(cnt2, 0, sizeof(cnt2));
    scanf("%d%s%s", &n, s, t);
    for (int i = 0; i < n; i++) cnt[s[i] - 'a' + 1]++, cnt2[t[i] - 'a' + 1]++;
    bool f = false;
    for (int i = 1; i <= 26; i++)
      if (cnt[i] != cnt2[i]) {
        f = true;
        break;
      }
    if (f) {
      puts("NO");
      continue;
    }
    for (int i = 1; i <= 26; i++)
      if (cnt[i] > 1) {
        f = true;
        break;
      }
    if (f) {
      puts("YES");
      continue;
    }
    if (solve(s) % 2 == solve(t) % 2)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
