#include <bits/stdc++.h>
using namespace std;
const long long C = 106;
const long long N = 1e5 + 17;
const long long mod = 1e9 + 7;
void solve() {
  long long n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  long long cnt_s[26] = {0};
  long long cnt_t[26] = {0};
  for (auto &x : s) cnt_s[x - 'a']++;
  for (auto &x : t) cnt_t[x - 'a']++;
  bool ok = true, found = false;
  ;
  for (long long i = (long long)0; i <= (long long)25; i++) {
    ok &= (cnt_s[i] == cnt_t[i]);
    found |= (cnt_s[i] >= 2);
  }
  if (!ok) {
    cout << "NO";
    return;
  } else if (found) {
    cout << "YES";
    return;
  } else {
    if (s.size() == 1) {
      cout << "YES";
      return;
    }
    if (s.size() == 2) {
      cout << (s == t ? "YES" : "NO") << "\n";
      return;
    }
    for (long long i = (long long)0; i <= (long long)(long long)s.size() - 3;
         i++) {
      if (s[i] == t[i]) continue;
      long long pos = -1;
      for (long long j = (long long)i + 1; j <= (long long)s.size() - 1; j++) {
        if (s[j] == t[i]) {
          pos = j;
          break;
        }
      }
      for (long long j = (long long)pos - 1; j >= (long long)i; j--) {
        swap(s[j], s[j + 1]);
        swap(t[t.size() - 1], t[t.size() - 2]);
      }
    }
    if (s[n - 2] == t[n - 2] && s[n - 1] == t[n - 1]) {
      cout << "YES";
      return;
    } else {
      cout << "NO";
      return;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  srand(time(0));
  long long t24 = 1;
  cin >> t24;
  while (t24--) {
    solve();
    cout << "\n";
  }
  return 0;
}
