#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long power(long long a, long long b, long long m = 1000000007) {
  long long answer = 1;
  while (b) {
    if (b & 1) answer = (answer * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return answer;
}
using namespace std;
void ctrl() { cout << "Control" << endl; }
long long make_num(string p) {
  stringstream geek(p);
  long long x = 0;
  geek >> x;
  return x;
}
string make_str(long long x) {
  ostringstream str1;
  str1 << x;
  string geek = str1.str();
  return geek;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  long long tc;
  cin >> tc;
  for (long long t = 1; t <= tc; t++) {
    long long n;
    cin >> n;
    string p, q;
    cin >> p >> q;
    string h = p, g = q;
    sort(h.begin(), h.end());
    sort(g.begin(), g.end());
    bool flag = true, same = false;
    for (long long i = 1; i < n; i++) {
      if (h[i] != g[i]) {
        flag = false;
      }
      if (i) {
        if (h[i] == h[i - 1]) same = true;
      }
    }
    if (!flag)
      cout << "NO\n";
    else if (flag && same)
      cout << "YES\n";
    else {
      long long cnt1 = 0, cnt2 = 0;
      for (long long l = 0; l < n; ++l) {
        for (long long r = 0; r < l; ++r) {
          cnt1 += p[l] < p[r];
          cnt2 += q[l] < q[r];
        }
      }
      long long cnt3 = 0, cnt4 = 0;
      for (long long i = 1; i < n; i++) {
        for (long long j = i - 1; j >= 0; j--) {
          if (p[j] > p[i]) swap(p[j], p[i]), cnt3++;
        }
      }
      for (long long i = 1; i < n; i++) {
        for (long long j = i - 1; j >= 0; j--) {
          if (q[j] > q[i]) swap(q[j], q[i]), cnt4++;
        }
      }
      if ((cnt1 - cnt2) % 2)
        cout << "NO\n";
      else
        cout << "YES\n";
    }
  }
  return 0;
}
