#include <bits/stdc++.h>
using namespace std;
int q, n;
string s, t, s1, t1;
int a[26], b[26];
int main() {
  ios::sync_with_stdio(false);
  cin >> q;
  while (q--) {
    cin >> n >> s >> t;
    s1 = s;
    t1 = t;
    memset(a, 0, sizeof(a));
    memset(b, 0, sizeof(b));
    for (int i = 0; i < n; i++) {
      a[s[i] - 'a']++;
      b[t[i] - 'a']++;
    }
    bool flag = 0;
    for (int i = 0; i < 26; i++) {
      if (a[i] >= 2) flag = 1;
    }
    sort(s1.begin(), s1.end());
    sort(t1.begin(), t1.end());
    if (s1 != t1) {
      cout << "NO" << endl;
    } else if (flag) {
      cout << "YES" << endl;
    } else {
      for (int i = 0; i < n - 2; i++) {
        int ct = 0;
        if (s[i] == t[i]) continue;
        int ed;
        for (ed = i + 1; ed < n; ed++)
          if (t[ed] == s[i]) break;
        for (int j = ed; j > i; j--) swap(t[j], t[j - 1]), ct++;
        if (ct & 1) swap(s[n - 1], s[n - 2]);
      }
      if (s != t) {
        cout << "NO" << endl;
      } else {
        cout << "YES" << endl;
      }
    }
  }
}
