#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <typename T, typename K>
inline void umax(T &a, K b) {
  a = max(a, (T)b);
}
template <typename T, typename K>
inline void umin(T &a, K b) {
  a = min(a, (T)b);
}
const int32_t N = 2e5 + 10;
const double EPS = 1e-6;
const long long II = 1e9 + 10;
const long long MOD = 1e9 + 123;
const long long MOD2 = 1e9 + 9;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long q;
  cin >> q;
  while (q--) {
    long long n;
    cin >> n;
    string second, t;
    cin >> second >> t;
    for (int32_t i = 0; i < (n); i++) second[i] -= 'a', t[i] -= 'a';
    bool gotans = false;
    vector<long long> cnts(26), cntt(26);
    long long ccs = 0, cct = 0;
    for (int32_t i = 0; i < (n); i++) {
      if (cnts[second[i]] || cntt[t[i]]) gotans = true;
      cnts[second[i]]++;
      cntt[t[i]]++;
      for (long long j = second[i] + 1; j < 26; j++) ccs += cnts[j];
      for (long long j = t[i] + 1; j < 26; j++) cct += cntt[j];
    }
    for (int32_t i = 0; i < (26); i++)
      if (cnts[i] != cntt[i]) {
        cout << "NO\n";
        goto TTT;
      }
    if (gotans || ccs % 2 == cct % 2)
      cout << "YES\n";
    else
      cout << "NO\n";
  TTT:;
  }
}
