#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool judge(string& s, string& t) {
  auto f = [](string& x, vector<int>& cnt) {
    ll res = 0;
    for (char c : x) {
      int v = c - 'a';
      for (int i = v + 1; i < 26; i++) res += cnt[i];
      cnt[v]++;
    }
    return res;
  };
  vector<int> vecS(26);
  vector<int> vecT(26);
  int nums = f(s, vecS), numt = f(t, vecT);
  return (nums % 2 == numt % 2 ||
          *max_element(vecS.begin(), vecS.end()) >= 2) &&
         vecS == vecT;
}
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    cout << (judge(s, t) ? "YES" : "NO") << endl;
  }
  return 0;
}
