#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using iii = tuple<int, int, int>;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) {
    int N;
    bool f = false;
    string A, B;
    cin >> N >> A >> B;
    int C[26] = {}, D[26] = {};
    for (char c : A) C[c - 'a']++;
    for (char c : B) D[c - 'a']++;
    for (int i = 0; i < 26; i++)
      if (f = C[i] != D[i]) break;
    if (f) {
      cout << "NO\n";
      continue;
    }
    for (int i = 0; i < 26; i++)
      if (f = C[i] >= 2) break;
    if (f) {
      cout << "YES\n";
      continue;
    }
    int a = 0, b = 0;
    for (int i = 1; i < N; i++)
      for (int j = 1; j < N; j++)
        if (A[j] < A[j - 1]) {
          a++;
          swap(A[j], A[j - 1]);
        }
    for (int i = 1; i < N; i++)
      for (int j = 1; j < N; j++)
        if (B[j] < B[j - 1]) {
          b++;
          swap(B[j], B[j - 1]);
        }
    cout << (a % 2 == b % 2 ? "YES" : "NO") << '\n';
  }
}
