#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int n;
char s[N], t[N];
int frq[2][26];
void solve() {
  scanf("%d", &n);
  scanf("%s", s);
  scanf("%s", t);
  bool can = false;
  memset(frq, 0, sizeof(frq));
  for (int i = 0; i < n; i++) {
    frq[0][s[i] - 'a']++;
    frq[1][t[i] - 'a']++;
  }
  for (int i = 0; i < 26; i++) {
    if (frq[0][i] != frq[1][i]) {
      puts("NO");
      return;
    }
    if (frq[0][i] > 1) can = true;
  }
  if (can) {
    puts("YES");
    return;
  }
  int a = 0, b = 0;
  int mn = 1000000010, idx = -1;
  for (int i = 0; i < n; i++) {
    mn = s[i], idx = i;
    for (int j = i + 1; j < n; j++) {
      if (s[j] < mn) {
        mn = s[j];
        idx = j;
      }
    }
    while (idx > i) {
      swap(s[idx], s[idx - 1]);
      a++;
      idx--;
    }
  }
  for (int i = 0; i < n; i++) {
    mn = t[i], idx = i;
    for (int j = i + 1; j < n; j++) {
      if (t[j] < mn) {
        mn = t[j];
        idx = j;
      }
    }
    while (idx > i) {
      swap(t[idx], t[idx - 1]);
      b++;
      idx--;
    }
  }
  if (a % 2 == b % 2)
    puts("YES");
  else
    puts("NO");
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}
