#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int MAX = 2e5 + 5;
const long long MAX2 = 11;
const long long MOD = 1000000007;
const long long MOD2 = 1000005329;
const long long INF = 2e18;
const int dr[] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1, 0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 2000;
int tc, n, cnt[128], st;
long long a, b;
string s, t;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> tc;
  while (tc--) {
    cin >> n >> s >> t;
    memset(cnt, 0, sizeof cnt);
    st = 0;
    for (auto i : s) {
      ++cnt[i];
      if (cnt[i] == 2) st = 1;
    }
    for (auto i : t) --cnt[i];
    for (long long i = 0; i <= 127; ++i)
      if (cnt[i] != 0) st = -1;
    if (st == -1)
      cout << "NO\n";
    else if (st)
      cout << "YES\n";
    else {
      --n, a = b = 0;
      for (int i = n; i >= 1; --i)
        for (long long j = 1; j <= n; ++j)
          if (s[j - 1] > s[j]) swap(s[j - 1], s[j]), ++a;
      for (int i = n; i >= 1; --i)
        for (long long j = 1; j <= n; ++j)
          if (t[j - 1] > t[j]) swap(t[j - 1], t[j]), ++b;
      if (a % 2 != b % 2)
        cout << "NO\n";
      else
        cout << "YES\n";
    }
  }
  return 0;
}
