#include <bits/stdc++.h>
using namespace std;
const int Nmax = 1e6 + 7;
int n;
string s, t;
int cnts[31], cntt[31];
inline int check() {
  memset(cnts, 0, sizeof(cnts));
  memset(cntt, 0, sizeof(cntt));
  for (int i = 0; i < n; i++) {
    cnts[s[i] - 'a']++;
    cntt[t[i] - 'a']++;
  }
  for (int i = 0; i < 30; i++) {
    if (cnts[i] != cntt[i]) return -1;
  }
  for (int i = 0; i < 30; i++) {
    if (cnts[i] > 1) return 1;
  }
  return 0;
}
int pos[33];
int main() {
  int _;
  cin >> _;
  while (_--) {
    cin >> n;
    cin >> s >> t;
    int flag = check();
    if (flag == 1) {
      cout << "YES" << endl;
      continue;
    } else if (flag == -1) {
      cout << "NO" << endl;
      continue;
    }
    memset(pos, 0, sizeof(pos));
    for (int i = 0; i < n; i++) {
      pos[t[i] - 'a'] = i;
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if (pos[s[i] - 'a'] > pos[s[j] - 'a']) cnt++;
      }
    }
    if (cnt & 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
