#include <bits/stdc++.h>
using namespace std;
const int maxn = 200020;
int T, n, cnts[26], cntt[26], f[maxn], c[maxn];
char s[maxn], t[maxn];
bool check() {
  memset(f + 1, 0, sizeof(int) * n);
  memset(c + 1, 0, sizeof(int) * n);
  memset(cnts, 0, sizeof(cnts));
  memset(cntt, 0, sizeof(cntt));
  for (int i = 1; i <= n; i++) {
    cnts[s[i] - 'a']++;
    cntt[t[i] - 'a']++;
  }
  for (int i = 0; i < 26; i++)
    if (cnts[i] != cntt[i]) return false;
  for (int i = 0; i < 26; i++)
    if (cnts[i] > 1) return true;
  int cnt1 = 0, cnt2 = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (s[i] > s[j]) cnt1++;
      if (t[i] > t[j]) cnt2++;
    }
  }
  return (cnt1 % 2 == cnt2 % 2);
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d%s%s", &n, s + 1, t + 1);
    puts(check() ? "YES" : "NO");
  }
  return 0;
}
