#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 22;
int T, n;
char s1[N], s2[N];
int a[N], t[N];
map<char, int> m1, m2;
inline long long merge(int l, int mid, int r) {
  int i = l, j = mid + 1, k = 0;
  long long an = 0;
  while (i <= mid && j <= r) {
    if (a[i] > a[j]) {
      an += (mid - i + 1);
      t[k++] = a[j++];
    } else {
      t[k++] = a[i++];
    }
  }
  while (i <= mid) {
    t[k++] = a[i++];
  }
  while (j <= r) t[k++] = a[j++];
  for (int g = 0; g < k; g++) a[l + g] = t[g];
  return an;
}
inline long long query(int l, int r) {
  long long ans = 0;
  if (l < r) {
    int mid = (l + r) >> 1;
    ans += query(l, mid);
    ans += query(mid + 1, r);
    ans += merge(l, mid, r);
  }
  return ans;
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    m1.clear();
    m2.clear();
    for (int i = 0; i <= n; i++) t[i] = 0;
    scanf("%s%s", s1 + 1, s2 + 1);
    for (int i = 1; i <= n; i++) m1[s1[i]]++, m2[s2[i]]++;
    bool f = 0;
    for (int i = 'a'; i <= 'z'; i++) {
      if (m1[i] != m2[i]) {
        puts("NO");
        f = 1;
        break;
      }
    }
    if (f) continue;
    for (int i = 'a'; i <= 'z'; i++) {
      if (m1[i] >= 2) {
        puts("YES");
        f = 1;
        break;
      }
    }
    if (f) continue;
    for (int i = 1; i <= n; i++) {
      a[i] = s1[i] - 97;
    }
    long long tmp1 = query(1, n);
    for (int i = 0; i <= n; i++) t[i] = 0;
    for (int i = 1; i <= n; i++) {
      a[i] = s2[i] - 97;
    }
    long long tmp2 = query(1, n);
    ;
    if (tmp1 % 2 == tmp2 % 2) {
      puts("YES");
    } else
      puts("NO");
  }
  return 0;
}
