#include <bits/stdc++.h>
using namespace std;
long long po(long long x, long long y) {
  if (y == 0)
    return 1;
  else
    return x * po(x, y - 1);
}
int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    long long dp[26]{0};
    long long f = 0;
    for (long long i = 0; i < n; i++) {
      dp[s[i] - 'a']++;
      if (dp[s[i] - 'a'] > 1) f = 1;
    }
    for (long long i = 0; i < n; i++) dp[t[i] - 'a']--;
    long long res = 0;
    for (long long i = 0; i < 26; i++) {
      if (dp[i] != 0) {
        cout << "NO\n";
        res = 1;
        break;
      }
    }
    if (res) continue;
    if (f) {
      cout << "YES\n";
      continue;
    }
    long long inv1 = 0;
    for (long long i = 0; i < n; i++) {
      for (long long j = i + 1; j < n; j++) {
        if (s[j] < s[i]) inv1++;
      }
    }
    long long inv2 = 0;
    for (long long i = 0; i < n; i++) {
      for (long long j = i + 1; j < n; j++) {
        if (t[j] < t[i]) inv2++;
      }
    }
    if ((inv2 & 1) ^ (inv1 & 1))
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
