#include <bits/stdc++.h>
using namespace std;
namespace wode {
template <typename T>
inline void read(T &x) {
  static char ch;
  bool f = 1;
  for (x = 0, ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') f = 0;
  for (; isdigit(ch); x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar())
    ;
  x = f ? x : -x;
}
template <typename T>
void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
inline void print(T x, char ap) {
  print(x);
  if (ap) putchar(ap);
}
template <typename T>
inline T max(const T &x, const T &y) {
  return x < y ? y : x;
}
template <typename T>
inline T min(const T &x, const T &y) {
  return x < y ? x : y;
}
template <typename T>
inline void chkmax(T &x, const T &y) {
  x = x < y ? y : x;
}
template <typename T>
inline void chkmin(T &x, const T &y) {
  x = x < y ? x : y;
}
}  // namespace wode
using wode::chkmax;
using wode::chkmin;
using wode::print;
using wode::read;
int t, n, tong1[26], tong2[26];
char s1[200001], s2[200001];
int main() {
  ios::sync_with_stdio(false);
  cin >> t;
  while (t--) {
    cin >> n >> (s1 + 1) >> (s2 + 1), memset(tong1, 0, sizeof(tong1)),
        memset(tong2, 0, sizeof(tong2));
    for (register int i = 1; i <= n; ++i)
      ++tong1[s1[i] - 'a'], ++tong2[s2[i] - 'a'];
    bool ff = true;
    for (register int i = 0; i < 26; ++i)
      if (tong1[i] != tong2[i]) {
        ff = false;
        break;
      }
    if (!ff) {
      cout << "NO" << '\n';
      continue;
    }
    ff = false;
    for (register int i = 0; i < 26; ++i)
      if (tong1[i] > 1) {
        ff = true;
        break;
      }
    if (ff) {
      cout << "YES" << '\n';
      continue;
    }
    int tot1 = 0, tot2 = 0;
    for (register int i = 1; i < n; ++i)
      for (register int j = i + 1; j <= n; ++j) {
        if (s1[i] > s1[j]) ++tot1;
        if (s2[i] > s2[j]) ++tot2;
      }
    if ((tot1 & 1) == (tot2 & 1))
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
  }
  cout << flush;
  return 0;
}
