#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U>
using Pa = pair<T, U>;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
void solve() {
  int N;
  cin >> N;
  string S, T;
  cin >> S >> T;
  vec<int> cntS(26), cntT(26);
  for (int i = 0; i < N; i++) cntS[S[i] - 'a']++;
  for (int i = 0; i < N; i++) cntT[T[i] - 'a']++;
  if (cntS != cntT) {
    cout << "NO\n";
    return;
  }
  if (*max_element(cntS.begin(), cntS.end()) >= 2) {
    cout << "YES\n";
    return;
  }
  int s = 0, t = 0;
  for (int i = 0; i < N; i++)
    for (int j = i + 1; j < N; j++) {
      s += (S[i] < S[j]);
      t += (T[i] < T[j]);
    }
  cout << (s % 2 == t % 2 ? "YES\n" : "NO\n");
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    solve();
  }
}
