#include <bits/stdc++.h>
using namespace std;
int cas;
int n;
char s[200005];
char t[200005];
int cnt[2][30];
int tree[100];
int lowbit(int x) { return x & -x; }
void ins(int pos, int val) {
  for (; pos <= 26; pos += lowbit(pos)) tree[pos] += val;
}
int query(int pos) {
  int sum = 0;
  for (; pos; pos -= lowbit(pos)) sum += tree[pos];
  return sum;
}
bool check() {
  int ans = 0;
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= n; ++i) ++cnt[0][s[i] - 'a'];
  for (int i = 1; i <= n; ++i) ++cnt[1][t[i] - 'a'];
  for (int i = 0; i < 26; ++i)
    if (cnt[0][i] != cnt[1][i]) return false;
  for (int i = 0; i < 26; ++i)
    if (cnt[0][i] >= 2 || cnt[1][i] >= 2) return true;
  memset(tree, 0, sizeof(tree));
  for (int i = 1; i <= n; ++i) {
    int pos = s[i] - 'a' + 1;
    ins(pos, 1);
    ans += i - query(pos);
  }
  memset(tree, 0, sizeof(tree));
  for (int i = 1; i <= n; ++i) {
    int pos = t[i] - 'a' + 1;
    ins(pos, 1);
    ans += i - query(pos);
  }
  return ans % 2 == 0;
}
int main() {
  scanf("%d", &cas);
  while (cas--) {
    scanf("%d", &n);
    scanf("%s %s", s + 1, t + 1);
    if (check())
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
