#include <bits/stdc++.h>
using namespace std;
template <class c>
struct rge {
  c b, e;
};
template <class c>
rge<c> range(c i, c j) {
  return rge<c>{i, j};
}
template <class c>
auto dud(c* x) -> decltype(cerr << *x, 0);
template <class c>
char dud(...);
struct debug {
  template <class c>
  debug& operator<<(const c&) {
    return *this;
  }
};
int q, n;
string s, t;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> q;
  while (q--) {
    cin >> n >> s >> t;
    bool isDuplicated = false, areSameChar = true;
    int cnts[26] = {}, cntt[26] = {};
    for (int i = 0; i < n; i++) {
      cnts[s[i] - 'a']++;
      cntt[t[i] - 'a']++;
    }
    for (int i = 0; i < 26; i++) {
      if (cnts[i] >= 2) isDuplicated = true;
      if (cnts[i] != cntt[i]) areSameChar = false;
    }
    if (areSameChar) {
      if (isDuplicated) {
        cout << "YES\n";
        continue;
      }
    } else {
      cout << "NO\n";
      continue;
    }
    int pairs = 0, pairt = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if (s[i] > s[j]) pairs++;
        if (t[i] > t[j]) pairt++;
      }
    }
    if (areSameChar && (isDuplicated || ((pairs - pairt) % 2 == 0))) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
