#include <bits/stdc++.h>
using namespace std;
long long solve() {
  long long n;
  cin >> n;
  string str1, str2;
  cin >> str1 >> str2;
  long long freq1[26] = {0};
  long long freq2[26] = {0};
  for (long long i = 0; i < n; i++) {
    freq1[str1[i] - 'a']++;
    freq2[str2[i] - 'a']++;
  }
  for (long long i = 0; i < 26; i++) {
    if (freq1[i] != freq2[i]) {
      cout << "NO\n";
      return 0;
    }
  }
  for (long long i = 0; i < 26; i++) {
    if (freq1[i] >= 2) {
      cout << "YES\n";
      return 0;
    }
  }
  for (long long i = 0; i < n - 2; i++) {
    long long pos = -1;
    for (long long j = i; j < n; j++) {
      if (str1[i] == str2[j]) {
        pos = j;
        break;
      }
    }
    long long cnt = 0;
    while (pos > i) {
      swap(str2[pos], str2[pos - 1]);
      cnt++;
      pos--;
    }
    cnt = cnt % 2;
    if (cnt == 0)
      continue;
    else
      swap(str2[n - 1], str2[n - 2]);
  }
  for (long long i = 0; i < n; i++) {
    if (str1[i] != str2[i]) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  long long t = 1;
  cin >> t;
  while (t-- != 0) {
    long long stat = solve();
  }
  return 0;
}
