#include <bits/stdc++.h>
#pragma GCC optimize( \
    "Ofast,no-stack-protector,unroll-loops,no-stack-protector,fast-math")
using namespace std;
const int N = 2e5 + 5, M = 2e5 + 5;
int n;
char a[N], b[N];
int cnt[26];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d %s %s", &n, a, b);
    memset(cnt, 0, sizeof cnt);
    bool ok = false;
    for (int i = 0; i < n; ++i) ok |= (++cnt[a[i] - 'a'] > 1);
    for (int i = 0; i < n; ++i) --cnt[b[i] - 'a'];
    bool nonzero = false;
    for (int i = 0; i < 26; ++i) nonzero |= (cnt[i] != 0);
    if (nonzero) {
      puts("NO");
      continue;
    }
    if (ok) {
      puts("YES");
      continue;
    }
    int inva = 0, invb = 0;
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < i; ++j) inva += (a[i] > a[j]), invb += (b[i] > b[j]);
    puts((inva & 1) == (invb & 1) ? "YES" : "NO");
  }
}
