#include <bits/stdc++.h>
using namespace std;
bool solve() {
  int n;
  string s[2];
  cin >> n >> s[0] >> s[1];
  vector<int> L[2];
  int inv[2] = {0};
  for (int i = 0; i < 2; i++) {
    L[i].resize(26);
    for (char c : s[i]) {
      L[i][c - 'a']++;
      for (int j = c - 'a' + 1; j < 26; j++) {
        inv[i] += L[i][j];
      }
    }
  }
  if (L[0] != L[1]) return false;
  if (*max_element(L[0].begin(), L[0].end()) >= 2) return true;
  if ((inv[1] - inv[0]) % 2 == 0) return true;
  return false;
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    printf("%s\n", solve() ? "YES" : "NO");
    ;
  }
}
