#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const int maxn = 200009;
const int maxd = 100009;
const int inf = 1000000000;
int mod = 1000000007;
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    string a, b;
    cin >> a >> b;
    int p1[30], p2[30];
    memset(p1, 0, sizeof(p1));
    memset(p2, 0, sizeof(p2));
    for (int i = 0; i < n; ++i) {
      ++p1[a[i] - 'a'];
      ++p2[b[i] - 'a'];
    }
    int fg = 0, good = 0;
    for (int i = 0; i < 26; ++i) {
      if (p1[i] > 1) good = 1;
      if (p1[i] != p2[i]) {
        fg = 1;
        break;
      }
    }
    if (fg) {
      puts("NO");
      continue;
    }
    if (good) {
      puts("YES");
      continue;
    }
    int k1 = 0, k2 = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = i; j < n; ++j) {
        if (a[j] < a[i]) ++k1;
        if (b[j] < b[i]) ++k2;
      }
    }
    if (k1 % 2 == k2 % 2)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
