#include <bits/stdc++.h>
int main() {
  int q;
  std::cin >> q;
  for (int q0 = 0; q0 < q; ++q0) {
    int n;
    std::string s, t;
    std::cin >> n >> s >> t;
    std::array<int, 26> cnt_s = {}, cnt_t = {};
    long long inv_s = 0, inv_t = 0;
    for (int i = 0; i < n; ++i) {
      ++cnt_s[s[i] - 'a'];
      ++cnt_t[t[i] - 'a'];
      for (int j = 25; j > s[i] - 'a'; --j) {
        inv_s += cnt_s[j];
      }
      for (int j = 25; j > t[i] - 'a'; --j) {
        inv_t += cnt_t[j];
      }
    }
    bool flag = true, more = false;
    for (int i = 0; i < 26; ++i) {
      flag &= (cnt_s[i] == cnt_t[i]);
      more |= (std::max(cnt_s[i], cnt_t[i]) > 1);
    }
    if (!flag) {
      std::cout << "NO\n";
    } else if (more) {
      std::cout << "YES\n";
    } else if ((inv_s + inv_t) & 1) {
      std::cout << "NO\n";
    } else {
      std::cout << "YES\n";
    }
  }
  return 0;
}
