#include <bits/stdc++.h>
using namespace std;
void answer() {
  int n;
  string s, t;
  cin >> n >> s >> t;
  int ps[26], pt[26];
  int cs[26], ct[26];
  memset(ps, -1, sizeof(ps));
  memset(pt, -1, sizeof(pt));
  memset(cs, 0, sizeof(cs));
  memset(ct, 0, sizeof(ct));
  for (int i = 0; i < s.size(); i++) {
    ps[s[i] - 'a'] = i;
    cs[s[i] - 'a']++;
  }
  for (int i = 0; i < t.size(); i++) {
    pt[t[i] - 'a'] = i;
    ct[t[i] - 'a']++;
  }
  for (int i = 0; i < 26; i++) {
    if (cs[i] != ct[i]) {
      cout << "NO" << '\n';
      return;
    }
  }
  int c = 0;
  for (int i = 0; i < 26; i++) {
    if (cs[i] > 1 || ct[i] > 1) {
      cout << "YES" << '\n';
      return;
    }
    for (int j = i + 1; j < 26; j++) {
      c += ((ps[i] < ps[j]) != (pt[i] < pt[j]));
    }
  }
  if (c % 2)
    cout << "NO" << '\n';
  else
    cout << "YES" << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) answer();
  return 0;
}
