#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
template <typename T>
struct BIT {
  vector<T> bit;
  BIT(int sz) { bit.resize(sz); }
  void add(int k, T x) {
    for (int i = k; i < bit.size(); i |= i + 1) bit[i] += x;
  }
  T sum(int k) {
    T res = 0;
    for (int i = k; i >= 0; i = (i & (i + 1)) - 1) {
      res += bit[i];
    }
    return res;
  }
};
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    vector<int> nums(26), numt(26);
    for (int i = (int)(0); i < (int)(n); i++) {
      nums[s[i] - 'a']++;
      numt[t[i] - 'a']++;
    }
    if (nums != numt) {
      cout << "NO" << endl;
    } else {
      bool ok = false;
      for (int i = (int)(0); i < (int)(26); i++) {
        if (nums[i] >= 2) {
          ok = true;
        }
      }
      if (ok) {
        cout << "YES" << endl;
        continue;
      }
      BIT<int> bits(26), bitt(26);
      int sums = 0;
      int sumt = 0;
      for (int i = (int)(0); i < (int)(n); i++) {
        bits.add(s[i] - 'a', 1);
        sums += bits.sum(s[i] - 'a' - 1);
        bitt.add(t[i] - 'a', 1);
        sumt += bitt.sum(t[i] - 'a' - 1);
      }
      if (sums % 2 == sumt % 2)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
}
