#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
char buf[1 << 21], *p1 = buf, *p2 = buf;
inline int gc() {
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  int ret = 0, f = 0;
  char c = gc();
  while (!isdigit(c)) {
    if (c == '-') f = 1;
    c = gc();
  }
  while (isdigit(c)) {
    ret = ret * 10 + c - 48;
    c = gc();
  }
  if (f) return -ret;
  return ret;
}
int vis[30];
int c[30];
inline int lowbit(int x) { return x & (-x); }
inline int query(int x) {
  int sum = 0;
  for (; x; x -= lowbit(x)) {
    sum += c[x];
  }
  return sum;
}
inline void add(int x) {
  for (; x <= 26; x += lowbit(x)) {
    c[x]++;
  }
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    string a, b;
    cin >> a >> b;
    string s1 = a, s2 = b;
    sort((s1).begin(), (s1).end());
    sort((s2).begin(), (s2).end());
    if (s1 != s2) {
      cout << "NO" << endl;
      continue;
    }
    memset(vis, 0, sizeof(vis));
    bool flag = false;
    for (auto x : a) {
      vis[x - 'a']++;
      if (vis[x - 'a'] > 1) {
        flag = true;
        break;
      }
    }
    if (flag) {
      cout << "YES" << endl;
      continue;
    }
    int sum1 = 0, sum2 = 0;
    reverse((a).begin(), (a).end());
    reverse((b).begin(), (b).end());
    memset(c, 0, sizeof(c));
    for (auto x : a) {
      sum1 += query(x - 'a' + 1);
      add(x - 'a' + 1);
    }
    memset(c, 0, sizeof(c));
    for (auto y : b) {
      sum2 += query(y - 'a' + 1);
      add(y - 'a' + 1);
    }
    if ((sum1 ^ sum2) & 1) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
  return 0;
}
