#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const long long INF = std::numeric_limits<long long>::max();
const int MX = 100101;
const long double PI =
    3.14159265358979323846264338327950288419716939937510582097494L;
template <typename T>
pair<T, T> operator+(const pair<T, T> &a, const pair<T, T> &b) {
  return pair<T, T>(a.first + b.first, a.second + b.second);
}
template <typename T>
pair<T, T> operator-(const pair<T, T> &a, const pair<T, T> &b) {
  return pair<T, T>(a.first - b.first, a.second - b.second);
}
template <typename T>
T operator*(const pair<T, T> &a, const pair<T, T> &b) {
  return (a.first * b.first + a.second * b.second);
}
template <typename T>
T operator^(const pair<T, T> &a, const pair<T, T> &b) {
  return (a.first * b.second - a.second * b.first);
}
template <typename T>
void print(vector<T> vec, string name = "") {
  cout << name;
  for (auto u : vec) cout << u << ' ';
  cout << '\n';
}
struct FENWICK {
  vector<int> A;
  int N;
  FENWICK(int n) : N(n) { A.resize(n + 1, 0); }
  void add(int i, int first) {
    for (; i <= N; i += (i) & (-i)) A[i] += first;
  }
  int getQ(int i) {
    int get = 0;
    for (; i > 0; i -= (i) & (-i)) get += A[i];
    return get;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int N;
    cin >> N;
    std::string s, t;
    cin >> s >> t;
    queue<int> kur[30];
    for (int i = 0; i < N; ++i) kur[t[i] - 'a'].push(i);
    FENWICK medis(N + 1);
    int viso = 0;
    bool padariau = false;
    bool YRA = false;
    for (int i = 0; i < N; ++i) {
      if (kur[s[i] - 'a'].size() >= 2) YRA = true;
      if (kur[s[i] - 'a'].empty()) {
        printf("NO\n");
        padariau = true;
        break;
      }
      int sek = kur[s[i] - 'a'].front();
      kur[s[i] - 'a'].pop();
      int kiekuz = medis.getQ(N + 1) - medis.getQ(sek + 1);
      int reik;
      if (i == sek) {
        continue;
      } else {
        reik = sek + kiekuz - i;
      }
      viso += reik;
      medis.add(sek + 1, 1);
    }
    if (padariau) continue;
    if (YRA)
      printf("YES\n");
    else if (viso & 1)
      printf("NO\n");
    else
      printf("YES\n");
  }
}
