#include <bits/stdc++.h>
using namespace std;
const int MOD7 = 1000000000 + 7;
const int MOD9 = 1000000000 + 9;
int main() {
  int t = ({
    int x;
    scanf("%d", &x);
    x;
  });
  for (int _ = (0); _ < (t); _ += (1)) {
    int n = ({
      int x;
      scanf("%d", &x);
      x;
    });
    string a, b;
    cin >> a >> b;
    vector<int> h(26), h2(26);
    for (int i = (0); i < (n); i += (1)) {
      h[a[i] - 'a']++;
      h2[b[i] - 'a']++;
    }
    bool ok = true;
    for (int i = (0); i < (26); i += (1)) {
      if (h[i] != h2[i]) {
        ok = false;
      }
    }
    int dup = 0;
    if (ok) {
      for (int i = (0); i < (26); i += (1))
        if (h[i] > 1) {
          dup = 1;
          break;
        }
      int c = 0;
      if (!dup) {
        for (int i = (0); i < (n); i += (1)) {
          int pos = -1;
          for (int j = (i); j < (n); j += (1)) {
            if (b[j] == a[i]) {
              pos = j;
              break;
            }
          }
          c += pos - i;
          string newB = "";
          for (int j = (0); j < (i); j += (1)) {
            newB += b[j];
          }
          newB += a[i];
          for (int j = (i); j < (n); j += (1)) {
            if (j != pos) newB += b[j];
          }
          b = newB;
        }
        if (c % 2) ok = false;
      }
    }
    cout << (ok ? "YES" : "NO") << "\n";
  }
}
