#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
const int MAXP = 26;
int tr[MAXP + 1];
int tmp[MAXP + 1];
void update(int p, int v) {
  p++;
  for (int i = p; i <= MAXP; i += i & -i) tr[i] += v;
}
int query(int p) {
  int r = 0;
  p++;
  for (int i = p; i; i -= i & -i) r += tr[i];
  return r;
}
void clear() {
  for (int i = 0; i <= MAXP; i++) tr[i] = 0;
}
string s1, s2;
int n;
signed main() {
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    cin >> n;
    assert(n <= MAXN);
    cin >> s1 >> s2;
    n = s1.length();
    assert(s1.length() == s2.length());
    for (int i = 0; i <= MAXP; i++) tmp[i] = 0;
    int flag = 0;
    for (int i = 0; i < n; i++) {
      tmp[s1[i] - 'a']++;
    }
    for (int i = 0; i < 26; i++) {
      if (tmp[i] > 1) flag = 1;
    }
    clear();
    for (int i = 0; i < n; i++) {
      tr[s2[i] - 'a']++;
    }
    for (int i = 0; i < 26; i++) {
      if (tr[i] > 1 && flag != -1) flag = 1;
      if (tr[i] != tmp[i]) flag = -1;
    }
    if (flag == 1) {
      cout << "YES\n";
    } else if (flag == -1) {
      cout << "NO\n";
    } else {
      int v1 = 0, v2 = 0;
      clear();
      for (int i = n - 1; ~i; i--) {
        v1 += query(s1[i] - 'a' - 1);
        update(s1[i] - 'a', 1);
      }
      clear();
      for (int i = n - 1; ~i; i--) {
        v2 += query(s2[i] - 'a' - 1);
        update(s2[i] - 'a', 1);
      }
      if (v1 % 2 == v2 % 2) {
        cout << "YES\n";
      } else {
        cout << "NO\n";
      }
    }
  }
  cout.flush();
}
