#include <bits/stdc++.h>
using namespace std;
char s[200005], t[200005];
int main() {
  int n, q, tt, ts;
  int count;
  int res_s[50], res_t[50];
  cin >> q;
  while (q--) {
    cin >> n;
    memset(res_s, 0, sizeof(res_s));
    memset(res_t, 0, sizeof(res_t));
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      res_s[s[i] - 'a']++;
    }
    for (int i = 0; i < n; i++) {
      cin >> t[i];
      res_t[t[i] - 'a']++;
    }
    bool no = false, yes = false;
    for (int i = 0; i < 26; i++) {
      if (res_s[i] != res_t[i]) {
        no = true;
        break;
      }
      if (res_s[i] > 1) {
        yes = true;
      }
    }
    if (no) {
      cout << "NO" << endl;
      continue;
    } else {
      if (yes) {
        cout << "YES" << endl;
        continue;
      }
    }
    tt = ts = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < i; j++) {
        ts += s[j] > s[i];
        tt += t[j] > t[i];
      }
    }
    if ((ts ^ tt) & 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
