#include <bits/stdc++.h>
#pragma 03
using namespace std;
int merge(int arr[], int temp[], int left, int mid, int right) {
  int inv_count = 0;
  int i = left;
  int j = mid;
  int k = left;
  while ((i <= mid - 1) && (j <= right)) {
    if (arr[i] <= arr[j])
      temp[k++] = arr[i++];
    else {
      temp[k++] = arr[j++];
      inv_count = inv_count + (mid - i);
    }
  }
  while (i <= mid - 1) temp[k++] = arr[i++];
  while (j <= right) temp[k++] = arr[j++];
  for (i = left; i <= right; i++) arr[i] = temp[i];
  return inv_count;
}
int _mergeSort(int arr[], int temp[], int left, int right) {
  int mid, inv_count = 0;
  if (right > left) {
    mid = (right + left) / 2;
    inv_count = _mergeSort(arr, temp, left, mid);
    inv_count += _mergeSort(arr, temp, mid + 1, right);
    inv_count += merge(arr, temp, left, mid + 1, right);
  }
  return inv_count;
}
int countSwaps(int arr[], int n) {
  int temp[n];
  return _mergeSort(arr, temp, 0, n - 1);
}
int a[200005], b[200005];
int main() {
  int q, n;
  cin >> q;
  string s, t;
  bool dup = false;
  for (int i = 0; i < q; i++) {
    dup = false;
    cin >> n;
    for (int i = 0; i < n; i++) {
      a[i] = 0;
      b[i] = 0;
    }
    cin >> s >> t;
    int l = 'a';
    for (int i = 0; i < n; i++) {
      int x = s[i];
      a[i] = x - l;
      int y = t[i];
      b[i] = y - l;
    }
    sort(s.begin(), s.end());
    sort(t.begin(), t.end());
    for (int i = 0; i < n - 1; i++) {
      if (s[i + 1] == s[i] || t[i + 1] == t[i]) dup = true;
    }
    if (dup == true && s == t)
      cout << "YES\n";
    else if (s != t)
      cout << "NO\n";
    else {
      int r = countSwaps(a, n);
      int x = countSwaps(b, n);
      if ((r - x) % 2 == 0)
        cout << "YES\n";
      else
        cout << "NO\n";
    }
    for (int i = 0; i < n; i++) {
      a[i] = 0;
      b[i] = 0;
    }
  }
  return 0;
}
