#include <bits/stdc++.h>
using namespace std;
int Gcd(int a, int b) {
  if (b == 0) return a;
  return Gcd(b, a % b);
}
int Lcm(int a, int b) { return a / Gcd(a, b) * b; }
template <class T>
void read(T &x) {
  static char ch;
  static bool neg;
  for (ch = neg = 0; ch < '0' || '9' < ch; neg |= ch == '-', ch = getchar())
    ;
  for (x = 0; '0' <= ch && ch <= '9'; (x *= 10) += ch - '0', ch = getchar())
    ;
  x = neg ? -x : x;
}
const int maxn = 1e6 + 10;
char s1[maxn], s2[maxn];
int cnt1[26], cnt2[26];
int main() {
  int T;
  read(T);
  while (T--) {
    for (int i = 0; i < 26; i++) cnt1[i] = cnt2[i] = 0;
    int n, tag = 1;
    read(n);
    scanf("%s%s", s1, s2);
    for (int i = 0; i < n; i++) {
      cnt1[s1[i] - 'a']++;
      cnt2[s2[i] - 'a']++;
    }
    for (int i = 0; i < 26; i++) {
      if (cnt1[i] > 1 || cnt2[i] > 1) tag = 2;
      if (cnt1[i] != cnt2[i]) {
        tag = 0;
        break;
      }
    }
    if (tag == 0)
      puts("NO");
    else if (tag == 2)
      puts("YES");
    else {
      int res1 = 0, res2 = 0;
      for (int i = 0; i < n; i++) {
        for (int j = n - 1; j >= i + 1; j--) {
          if (s1[j] < s1[j - 1]) {
            swap(s1[j], s1[j - 1]);
            res1++;
          }
          if (s2[j] < s2[j - 1]) {
            swap(s2[j], s2[j - 1]);
            res2++;
          }
        }
      }
      if ((res1 - res2) & 1)
        puts("NO");
      else
        puts("YES");
    }
  }
  return 0;
}
