#include <bits/stdc++.h>
using namespace std;
int q, n, ct[205], mid;
char s[200005], t[200005], c;
bool ok, b[205], win;
int main() {
  scanf("%d", &q);
  for (int _ = 1; _ <= q; _++) {
    scanf("%d\n%s\n%s", &n, s + 1, t + 1);
    for (int i = 'a'; i <= 'z'; i++) {
      ct[i] = b[i] = 0;
    }
    win = false;
    for (int i = 1; i <= n; i++) {
      ct[s[i]]++;
      ct[t[i]]--;
      if (b[s[i]]) win = true;
      b[s[i]] = true;
    }
    ok = true;
    for (int i = 'a'; i <= 'z'; i++) {
      if (ct[i]) ok = false;
    }
    if (!ok) {
      printf("NO\n");
      continue;
    }
    if (n > 26 || win) {
      printf("YES\n");
      continue;
    }
    for (int i = 1; i < n - 1; i++) {
      if (t[i] == s[i]) continue;
      if (t[n] == s[i]) {
        c = t[n];
        t[n] = t[n - 1];
        t[n - 1] = c;
        c = s[n];
        s[n] = s[n - 1];
        s[n - 1] = c;
      }
      for (int j = i + 1; j < n; j++) {
        if (t[j] != s[i]) continue;
        mid = (j - i + 1) / 2;
        for (int k = 0; k < mid; k++) {
          c = t[i + k];
          t[i + k] = t[j - k];
          t[j - k] = c;
          c = s[i + k + 1];
          s[i + k + 1] = s[j - k + 1];
          s[j - k + 1] = c;
        }
        break;
      }
    }
    if (s[n] == t[n])
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
