#include <bits/stdc++.h>
using namespace std;
void solve() {
  string a, b, s, t;
  long long n;
  cin >> n >> a >> b;
  s = a, t = b;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  if (s != t) {
    cout << "NO\n";
    return;
  }
  for (long long i = 0; i < n - 1; i++) {
    if (s[i] == s[i + 1]) {
      cout << "YES\n";
      return;
    }
  }
  unordered_map<char, long long> m;
  for (long long i = 0; i < n; i++) {
    m[a[i]] = i;
  }
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    long long x = 0;
    for (long long j = 0; j <= i - 1; j++) {
      if (m[b[j]] > m[b[i]]) x++;
    }
    ans += m[b[i]] - i + x;
  }
  if (ans % 2 == 0)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) solve();
}
