#include <bits/stdc++.h>
using namespace std;
int getInv(const string& s) {
  int st['z' - 'a' + 1] = {0};
  int cnt = 0;
  for (int i = 0; i < (int)s.size(); ++i) {
    for (char j = s[i] + 1; j <= 'z'; ++j) cnt += st[j - 'a'];
    st[s[i] - 'a'] ^= 1;
  }
  return cnt & 1;
}
bool isUnique(string s) { return unique(s.begin(), s.end()) == s.end(); }
int main() {
  ios::sync_with_stdio(false);
  int tc;
  cin >> tc;
  for (int q = 0; q < tc; ++q) {
    int n;
    string s, t;
    cin >> n >> s >> t;
    string ss = s;
    string st = t;
    sort(ss.begin(), ss.end());
    sort(st.begin(), st.end());
    cout << ((ss == st && (!isUnique(ss) || getInv(s) == getInv(t))) ? "YES"
                                                                     : "NO")
         << endl;
  }
  return 0;
}
