#include <bits/stdc++.h>
using namespace std;
int calc(string& s) {
  int n = (int)s.size();
  int ans = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < i; ++j) ans += s[j] > s[i];
  return ans;
}
bool solve() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  set<char> S, T;
  for (char ch : s) S.insert(ch);
  for (char ch : t) T.insert(ch);
  if (S != T) return false;
  if ((int)S.size() != n) return true;
  return calc(s) % 2 == calc(t) % 2;
}
int main() {
  int test;
  cin >> test;
  while (test--) solve() ? cout << "YES\n" : cout << "NO\n";
}
