#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  return (b) == 0 ? (a) : gcd((b), ((a) % (b)));
}
template <class T>
inline T lcm(T a, T b) {
  return ((a) / gcd((a), (b)) * (b));
}
template <class T>
inline T BigMod(T Base, T power, T M = 1000000007) {
  if (power == 0) return 1;
  if (power & 1)
    return ((Base % M) * (BigMod(Base, power - 1, M) % M)) % M;
  else {
    T y = BigMod(Base, power / 2, M) % M;
    return (y * y) % M;
  }
}
template <class T>
inline T ModInv(T A, T M = 1000000007) {
  return BigMod(A, M - 2, M);
}
int fx[] = {-1, +0, +1, +0, +1, +1, -1, -1, +0};
int fy[] = {+0, -1, +0, +1, +1, -1, +1, -1, +0};
int day[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int f1[26], f2[26];
    memset(f1, 0, sizeof(f1));
    memset(f2, 0, sizeof(f2));
    string s1, s2;
    cin >> s1 >> s2;
    int tt1 = 0, tt2 = 0;
    for (int i = 0; i < n; i++) {
      for (int j = s1[i] - 'a' + 1; j < 26; j++) {
        if (f1[j]) tt1 += f1[j];
      }
      f1[s1[i] - 'a']++;
    }
    for (int i = 0; i < n; i++) {
      for (int j = s2[i] - 'a' + 1; j < 26; j++) {
        if (f2[j]) tt2 += f2[j];
      }
      f2[s2[i] - 'a']++;
    }
    int flag = 0;
    for (int i = 0; i < 26; i++) {
      if (f1[i] != f2[i]) {
        flag = 1;
        break;
      }
    }
    if (flag) {
      cout << "NO" << endl;
      continue;
    }
    if (tt1 == tt2 || abs(tt1 - tt2) % 2 == 0) {
      cout << "YES" << endl;
    } else {
      int clag = 0;
      if (tt1 < tt2) {
        for (int i = 0; i < 26; i++) {
          if (f1[i] > 1) {
            clag = 1;
            break;
          }
        }
      } else {
        for (int i = 0; i < 26; i++) {
          if (f2[i] > 1) {
            clag = 1;
            break;
          }
        }
      }
      if (clag) {
        cout << "YES";
      } else
        cout << "NO";
      cout << endl;
    }
  }
  return 0;
}
