#include <bits/stdc++.h>
using namespace std;
bool check(long long n, long long pos) { return n & (1LL << pos); }
long long Set(long long n, long long pos) { return n = n | (1LL << pos); }
long long freq[2][27];
string s, t;
bool solve(long long len) {
  memset(freq, 0, sizeof freq);
  long long invs, invt;
  invs = invt = 0;
  for (auto it : s) {
    freq[0][it - 'a']++;
    for (long long i = (it - 'a') + 1; i < 26; i++) {
      invs += freq[0][i];
    }
  }
  for (auto it : t) {
    freq[1][it - 'a']++;
    for (long long i = (it - 'a') + 1; i < 26; i++) {
      invt += freq[1][i];
    }
  }
  bool one = 0;
  for (long long i = 0; i < 26; i++) {
    if (freq[0][i] != freq[1][i]) return 0;
    if (freq[0][i] > 1) one = 1;
  }
  if (one) return 1;
  return invs % 2 == invt % 2;
}
int main() {
  long long i, j, k, l, m, n, o, r, q;
  long long testcase;
  long long input, flag, tag, ans;
  scanf("%lld", &testcase);
  for (long long cs = 1; cs <= testcase; cs++) {
    scanf("%lld", &n);
    cin >> s >> t;
    if (solve(n))
      printf("YES\n");
    else
      printf("NO\n");
  }
}
