#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int n, ch1[N], ch2[N];
char s[N], t[N];
bool work() {
  memset(ch1, 0, sizeof(ch1));
  memset(ch2, 0, sizeof(ch2));
  for (int i = 1; i <= n; i++) ch1[s[i] - 'a']++, ch2[t[i] - 'a']++;
  for (int i = 0; i < 26; i++)
    if (ch1[i] != ch2[i]) return false;
  for (int i = 0; i < 26; i++)
    if (ch1[i] >= 2) return true;
  int inv1 = 0, inv2 = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (s[i] > s[j]) inv1++;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (t[i] > t[j]) inv2++;
  if (inv2 % 2 == inv1 % 2) return true;
  return false;
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    scanf("%s%s", s + 1, t + 1);
    puts(work() ? "YES" : "NO");
  }
  return 0;
}
