#include <bits/stdc++.h>
using namespace std;
int aa[30], bb[30];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    memset(aa, 0, sizeof(aa));
    memset(bb, 0, sizeof(bb));
    int n;
    scanf("%d", &n);
    string a, b;
    cin >> a;
    cin >> b;
    for (int i = 0; i < n; i++) {
      aa[a[i] - 'a']++;
      bb[b[i] - 'a']++;
    }
    int ff = 0;
    for (int i = 0; i < 26; i++) {
      if (aa[i] != bb[i]) {
        printf("NO\n");
        ff = 1;
        break;
      }
    }
    if (ff) continue;
    if (n > 26) {
      printf("YES\n");
      continue;
    } else {
      int flag = 0;
      for (int i = 0; i < 26; i++) {
        if (aa[i] > 1) {
          printf("YES\n");
          flag = 1;
          break;
        }
      }
      if (flag) continue;
      long long cnt = 0;
      for (int i = 0; i < n; i++) {
        if (a[i] != b[i]) {
          int idd = -1;
          for (int j = i + 1; j < n; j++) {
            if (a[j] == b[i]) idd = j;
          }
          for (int j = idd; j > i; j--) {
            swap(a[j], a[j - 1]);
            cnt++;
          }
        }
      }
      if (cnt & 1)
        printf("NO\n");
      else
        printf("YES\n");
    }
  }
  return 0;
}
