#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
char s[200001];
char t[200001];
int al[26];
int bl[26];
int main() {
  int q;
  scanf("%d", &q);
  while (q--) {
    int n;
    scanf("%d", &n);
    scanf("%s", s);
    scanf("%s", t);
    memset(al, 0, sizeof(al));
    memset(bl, 0, sizeof(bl));
    for (int i = 0; i < n; i++) {
      al[s[i] - 'a']++;
      bl[t[i] - 'a']++;
    }
    int flag = 1;
    for (int i = 0; i < 26; i++) {
      if (al[i] != bl[i]) flag = 0;
      if (flag && al[i] >= 2) flag = 2;
    }
    if (!flag) {
      printf("NO\n");
      continue;
    }
    if (flag == 2) {
      printf("YES\n");
      continue;
    }
    int inv = 0;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < i; j++) {
        if (s[i] > s[j]) inv ^= 1;
        if (t[i] > t[j]) inv ^= 1;
      }
    printf("%s\n", inv ? "NO" : "YES");
  }
}
