#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
long long a[200005], b[200005], t[200005];
long long c(long long l, long long r, long long* a) {
  if (l == r - 1) return 0;
  long long ans = 0, m = (l + r + 1) / 2, k = l, ct = 0;
  ans += c(l, m, a) + c(m, r, a);
  for (long long i = l, j = m; i < m || j < r;) {
    if (j >= r || (i < m && a[i] <= a[j])) {
      t[k++] = a[i++];
      ct++;
    } else {
      t[k++] = a[j++];
      ans += m - l - ct;
    }
  }
  for (long long i = l; i < r; i++) a[i] = t[i];
  return ans;
}
bool solve() {
  long long n;
  string s, t;
  cin >> n >> s >> t;
  string ss = s, tt = t;
  sort((ss).begin(), (ss).end()), sort((tt).begin(), (tt).end());
  if (ss != tt) {
    return false;
  }
  for (long long i = 0; i < n - 1; i++) {
    if (ss[i] == ss[i + 1]) {
      return true;
    }
  }
  for (long long i = 0; i < n; i++) {
    a[i] = lower_bound((ss).begin(), (ss).end(), s[i]) - ss.begin();
    b[i] = lower_bound((ss).begin(), (ss).end(), t[i]) - ss.begin();
  }
  long long c1 = c(0, n, a), c2 = c(0, n, b);
  return (c1 & 1) == (c2 & 1);
}
signed main() {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  ;
  long long q;
  cin >> q;
  while (q--) {
    if (solve())
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
