#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;
struct BIT {
  long long n;
  vector<long long> bit;
  BIT() { init(); }
  BIT(long long n) : n(n) { init(); }
  void init() {
    bit.clear();
    bit.resize(n + 1, 0);
  }
  long long sum(long long i) {
    long long s = 0;
    while (i > 0) {
      s += bit[i];
      i -= i & -i;
    }
    return s;
  }
  long long sum(long long x, long long y) { return sum(y) - sum(x - 1); }
  void add(long long i, long long x) {
    while (i <= n) {
      bit[i] += x;
      i += i & -i;
    }
  }
  long long lower_bound(long long w) {
    if (w <= 0) return 0;
    long long x = 0, r = 1;
    while (r < n) r <<= 1;
    for (long long k = r; k > 0; k >>= 1) {
      if (x + k <= n && bit[x + k] < w) {
        w -= bit[x + k];
        x += k;
      }
    }
    return x + 1;
  }
};
int solve() {
  long long q;
  cin >> q;
  while (q--) {
    long long n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    BIT b1(26), b2(26);
    vector<long long> c1(n), c2(n);
    vector<long long> m1(26, 0), m2(26, 0);
    for (int i = 0; i < n; i++) {
      c1[i] = s[i] - 'a' + 1;
      c2[i] = t[i] - 'a' + 1;
      m1[s[i] - 'a']++;
      m2[t[i] - 'a']++;
    }
    bool fl = false;
    for (int i = 0; i < n; i++) {
      if (m2[s[i] - 'a'] == 0) {
        fl = true;
      }
    }
    if (fl) {
      cout << "NO" << endl;
      continue;
    }
    long long x = 0, y = 0;
    for (int i = 0; i < n; i++) {
      x += b1.sum(c1[i]);
      y += b2.sum(c2[i]);
      b1.add(c1[i], 1);
      b2.add(c2[i], 1);
    }
    long long v = *max_element(m1.begin(), m1.end());
    v = max(v, *max_element(m2.begin(), m2.end()));
    if (v >= 2) {
      cout << "YES" << endl;
      continue;
    }
    if (x % 2 == y % 2) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
  return 0;
}
int main() {
  cout.precision(10);
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
}
