#include <bits/stdc++.h>
using namespace std;
int main() {
  int flag, q, n, inversion1, inversion2;
  int cnt1[30] = {0}, cnt2[30] = {0};
  string s1, s2;
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    cin >> n;
    cin >> s1 >> s2;
    flag = 0;
    memset(cnt1, 0, sizeof(cnt1));
    memset(cnt2, 0, sizeof(cnt2));
    for (int j = 0; j <= n - 1; j++) {
      cnt1[s1[j] - 'a']++;
      cnt2[s2[j] - 'a']++;
    }
    for (int i = 0; i <= 25; i++) {
      if (cnt1[i] != cnt2[i]) {
        printf("NO\n");
        flag = 1;
        break;
      }
    }
    if (flag) {
      continue;
    }
    for (int i = 0; i <= 25; i++) {
      if (cnt1[i] >= 2 || cnt2[i] >= 2) {
        printf("YES\n");
        flag = 1;
        break;
      }
    }
    if (flag) {
      continue;
    }
    inversion1 = 0;
    inversion2 = 0;
    for (int i = 0; i <= n - 2; i++) {
      for (int j = i + 1; j <= n - 1; j++) {
        if (s1[j] < s1[i]) inversion1++;
        if (s2[j] < s2[i]) inversion2++;
      }
    }
    inversion1 %= 2;
    inversion2 %= 2;
    if (inversion1 == inversion2) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}
