#include <bits/stdc++.h>
using namespace std;
string a, b;
int cnta[26], cntb[26];
int posa[26], posb[26];
int main() {
  int n, i, j, x, y, ans, curr, temp, m, q;
  int tc;
  scanf("%d", &tc);
  while (tc--) {
    scanf("%d", &n);
    memset(cnta, 0, sizeof(cnta));
    memset(cntb, 0, sizeof(cntb));
    memset(posa, 0, sizeof(posa));
    memset(posb, 0, sizeof(posb));
    cin >> a >> b;
    for (i = 0; i < n; i++) {
      cnta[a[i] - 'a']++;
      cntb[b[i] - 'a']++;
      posa[a[i] - 'a'] = i;
      posb[b[i] - 'a'] = i;
    }
    bool can = 1;
    bool duplicate = 0;
    for (i = 0; i < 26; i++) {
      if (cnta[i] != cntb[i]) can = 0;
      if (cnta[i] > 1) duplicate = 1;
    }
    if (!can) {
      printf("NO\n");
      continue;
    }
    if (duplicate) {
      printf("YES\n");
      continue;
    }
    int last = -1;
    int ret = 0;
    int paritya = 0, parityb = 0;
    for (i = 0; i < 26; i++) {
      for (j = i + 1; j < 26; j++) {
        if (cnta[i] == 0 || cnta[j] == 0) continue;
        if (posa[i] < posa[j]) paritya++;
        if (posb[i] < posb[j]) parityb++;
      }
    }
    can = (paritya % 2) == (parityb % 2);
    if (!can)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
