#include <bits/stdc++.h>
using namespace std;
int check(string s) {
  int cnt = 0;
  int n = s.size();
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < i; j++) {
      if (s[j] > s[i]) cnt++;
    }
  }
  return cnt % 2;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s, k;
    cin >> s >> k;
    string s1 = s, k1 = k;
    vector<int> a(26);
    sort(s1.begin(), s1.end());
    sort(k1.begin(), k1.end());
    if (k1 != s1) {
      cout << "NO" << endl;
      continue;
    }
    for (int i = 0; i < n; i++) {
      a[s[i] - 'a']++;
    }
    bool c = false;
    for (int i = 0; i < 26; i++) {
      if (a[i] > 1) {
        c = true;
      }
    }
    if (c) {
      cout << "YES" << endl;
      continue;
    }
    if (check(k) == check(s))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
}
