#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
const long long INFLL = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 200000 + 5;
using namespace std;
int a[30], b[30];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    scanf("%d", &n);
    getchar();
    char s1[MAXN], s2[MAXN];
    scanf("%s%s", s1, s2);
    for (int i = 0; i < n; i++) {
      a[s1[i] - 'a']++;
      b[s2[i] - 'a']++;
    }
    bool q = true;
    bool p = false;
    for (int i = 0; i < 26; i++) {
      q &= (a[i] == b[i]);
      p |= ((a[i] == b[i]) && a[i] >= 2);
    }
    if (q == false) {
      printf("NO\n");
      continue;
    } else {
      if (p == true) {
        printf("YES\n");
        continue;
      } else {
        int cnt1 = 0;
        int cnt2 = 0;
        for (int i = 1; i < n; i++) {
          for (int j = 0; j < i; j++) {
            if (s1[i] < s1[j]) cnt1++;
            if (s2[i] < s2[j]) cnt2++;
          }
        }
        if ((cnt1 & 1) == (cnt2 & 1)) {
          printf("YES\n");
        } else {
          printf("NO\n");
        }
      }
    }
  }
  return 0;
}
