#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  string a;
  string b;
  cin >> t;
  while (t--) {
    cin >> n;
    cin >> a;
    cin >> b;
    vector<int> cnt1(26, 0), cnt2(26, 0);
    for (int i = 0; i < n; i++) {
      cnt1[a[i] - 'a']++, cnt2[b[i] - 'a']++;
    }
    bool flag = true, repeat = false;
    for (int c = 0; c < 26; c++) {
      if (cnt1[c] != cnt2[c]) {
        flag = false;
      }
      if (cnt1[c] > 1 || cnt2[c] > 1) repeat = true;
    }
    if (!flag) {
      cout << "NO" << endl;
      continue;
    }
    if (repeat) {
      cout << "YES" << endl;
      continue;
    }
    int inv1 = 0, inv2 = 0;
    for (int i = 0; i < n; i++)
      for (int j = i + 1; j < n; j++) {
        if (a[i] > a[j]) inv1++;
        if (b[i] > b[j]) inv2++;
      }
    cout << (inv1 % 2 == inv2 % 2 ? "YES" : "NO") << endl;
  }
  return 0;
}
