#include <bits/stdc++.h>
using namespace std;
const double Pi = acos(-1.0);
const int MAXN = 1e6 + 5;
int n, m, t;
char s[MAXN];
char ss[MAXN];
int pos1[26][MAXN], pos2[26][MAXN];
int main() {
  cin >> t;
  while (t--) {
    for (int i = 0; i <= 25; i++) pos1[i][0] = pos2[i][0] = 0;
    cin >> n >> s + 1 >> ss + 1;
    for (int i = 1; i <= n; i++) {
      int tmp;
      tmp = ++pos1[s[i] - 'a'][0];
      pos1[s[i] - 'a'][tmp] = i;
      tmp = ++pos2[ss[i] - 'a'][0];
      pos2[ss[i] - 'a'][tmp] = i;
    }
    int flag = 1, multi = 0;
    for (int i = 0; i <= 25; i++) {
      if (pos1[i][0] != pos2[i][0]) flag = 0;
      if (pos1[i][0] > 1) multi = 1;
    }
    if (!flag) {
      puts("NO");
      continue;
    }
    if (multi) {
      puts("YES");
      continue;
    }
    int sum1 = 0, sum2 = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        if (s[j] < s[i]) sum1++;
        if (ss[j] < ss[i]) sum2++;
      }
    }
    if (sum1 % 2 != sum2 % 2)
      puts("NO");
    else
      puts("YES");
  }
}
