#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s1, s2;
    cin >> n >> s1 >> s2;
    int a[26];
    for (int i = (0) - ((0) > (26)); i != (26) - ((0) > (26));
         i += 2 * ((0) < (26)) - 1)
      a[i] = 0;
    int cnt1 = 0, cnt2 = 0;
    for (int i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
         i += 2 * ((0) < (n)) - 1) {
      cnt1 += a[s1[i] - 'a'];
      for (int j = (s1[i] - 'a') - ((s1[i] - 'a') > (26));
           j != (26) - ((s1[i] - 'a') > (26));
           j += 2 * ((s1[i] - 'a') < (26)) - 1) {
        a[j]++;
      }
    }
    for (int i = (0) - ((0) > (26)); i != (26) - ((0) > (26));
         i += 2 * ((0) < (26)) - 1)
      a[i] = 0;
    for (int i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
         i += 2 * ((0) < (n)) - 1) {
      cnt2 += a[s2[i] - 'a'];
      for (int j = (s2[i] - 'a') - ((s2[i] - 'a') > (26));
           j != (26) - ((s2[i] - 'a') > (26));
           j += 2 * ((s2[i] - 'a') < (26)) - 1) {
        a[j]++;
      }
    }
    sort(s1.begin(), s1.end());
    sort(s2.begin(), s2.end());
    bool is = false;
    if (s1 == s2) {
      for (int i = (0) - ((0) > (n - 1)); i != (n - 1) - ((0) > (n - 1));
           i += 2 * ((0) < (n - 1)) - 1) {
        if (s1[i] == s1[i + 1]) is = true;
      }
    }
    if (is or (s1 == s2 and cnt1 % 2 == cnt2 % 2)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  }
}
