#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long exp(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans = ans * a;
    }
    a = a * a;
    b = b / 2;
  }
  return ans;
}
void Swap(char &a, char &b) {
  char temp = a;
  a = b;
  b = temp;
}
void addEle(vector<long long> &BIT, long long n, long long ind, long long x) {
  for (long long i = ind; i <= n; i += (i & (-i))) {
    BIT[i] += x;
  }
}
long long queryEle(vector<long long> &BIT, long long ind) {
  long long sum = 0;
  for (long long i = ind; i > 0; i -= (i & (-i))) {
    sum += BIT[i];
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long q, n, i, j, tempInd;
  string s1;
  string s2;
  cin >> q;
  while (q--) {
    bool f1 = false;
    cin >> n >> s1 >> s2;
    vector<long long> ctr(26, 0);
    vector<vector<long long>> Index(26);
    vector<long long> ptr(26, 0);
    vector<bool> present(n, true);
    vector<long long> BIT(n + 3, 0);
    for (i = 0; i < n; i++) {
      ctr[s1[i] - 'a'] += 1;
      if (ctr[s1[i] - 'a'] >= 2) {
        f1 = true;
      }
    }
    for (i = 0; i < n; i++) {
      Index[s2[i] - 'a'].push_back(i);
      ctr[s2[i] - 'a'] -= 1;
    }
    bool flag = true;
    for (i = 0; i < 26; i++) {
      if (ctr[i] != 0) {
        flag = false;
      }
    }
    if (!flag) {
      cout << "NO\n";
    } else {
      if (f1) {
        cout << "YES\n";
        goto END;
      }
      j = 0;
      for (i = 0; i < n; i++) {
        while (!present[j]) {
          j++;
        }
        if (s1[i] == s2[j]) {
          j++;
        } else {
          tempInd = Index[s1[i] - 'a'][ptr[s1[i] - 'a']];
          ptr[s1[i] - 'a'] += 1;
          long long eleErasedBefore = queryEle(BIT, tempInd + 1);
          long long eleErasedBeforeJ = queryEle(BIT, j + 1);
          if ((tempInd - j - eleErasedBefore + eleErasedBeforeJ) % 2 != 0) {
            if (i + 1 == n - 1) {
              cout << "NO\n";
              goto END;
            } else {
              Swap(s1[i + 1], s1[i + 2]);
            }
          }
          addEle(BIT, n, tempInd + 2, 1);
          present[tempInd] = false;
        }
      }
      cout << "YES\n";
    }
  END:;
  }
  return 0;
}
