#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
long long n, q, f, flag;
string s, t;
long long sum1, sum2;
long long cnt1[26], cnt2[26];
int main() {
  cin >> q;
  while (q--) {
    sum1 = 0;
    sum2 = 0;
    f = 0;
    flag = 0;
    for (int i = 0; i <= 25; i++) {
      cnt1[i] = 0;
      cnt2[i] = 0;
    }
    cin >> n >> s >> t;
    for (int i = 0; i < n; i++) {
      cnt1[s[i] - 'a']++;
      cnt2[t[i] - 'a']++;
      for (int j = s[i] - 'a'; j <= 25; j++) {
        sum1 += cnt1[j];
      }
      for (int j = t[i] - 'a'; j <= 25; j++) {
        sum2 += cnt2[j];
      }
    }
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    for (int i = 0; i < n; i++) {
      if (s[i] != t[i]) {
        f = 1;
        break;
      }
    }
    if (f) {
      cout << "NO" << endl;
      continue;
    }
    for (int i = 1; i < n; i++) {
      if (s[i] == s[i - 1]) {
        flag = 1;
        break;
      }
    }
    if (flag) {
      cout << "YES" << endl;
      continue;
    }
    if ((sum1 - sum2) & 1)
      cout << "NO" << endl;
    else
      cout << "YES" << endl;
  }
  return 0;
}
