#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand(long long l, long long r) {
  uniform_int_distribution<long long> uid(l, r);
  return uid(rng);
}
const int N = 5e5 + 5;
bool vis[N];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    string s1 = s;
    string t1 = t;
    sort(s1.begin(), s1.end());
    sort(t1.begin(), t1.end());
    if (s1 != t1) {
      cout << "NO" << endl;
      continue;
    }
    bool done = 0;
    for (int i = 0; i <= n - 2; i++) {
      if (s1[i] == s1[i + 1]) {
        done = 1;
      }
      if (t1[i] == t1[i + 1]) {
        done = 1;
      }
    }
    if (done) {
      cout << "YES" << endl;
      continue;
    }
    int x1 = 0, x2 = 0;
    for (int k = 0; k <= n; k++) {
      for (int i = 0; i <= n - 2; i++) {
        if (s[i] > s[i + 1]) {
          swap(s[i], s[i + 1]);
          x1++;
        }
      }
    }
    for (int k = 0; k <= n; k++) {
      for (int i = 0; i <= n - 2; i++) {
        if (t[i] > t[i + 1]) {
          swap(t[i], t[i + 1]);
          x2++;
        }
      }
    }
    if (abs(x1 - x2) & 1) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
  return 0;
}
