#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    string t;
    cin >> t;
    map<char, int> found;
    map<char, int> found2;
    bool match = false;
    for (int i = 0; i < (int)(n); i++) {
      if (found[s[i]]) match = true;
      found[s[i]]++;
      found2[t[i]]++;
    }
    if (found != found2) {
      cout << "NO" << endl;
      continue;
    }
    if (match) {
      cout << "YES" << endl;
      continue;
    }
    int swaps = 0;
    for (int i = 0; i <= n - 3; i++) {
      int j = i;
      while (s[i] != t[j]) j++;
      swaps += j - i;
      while (j > i) {
        swap(t[j], t[j - 1]);
        j--;
      }
    }
    swaps %= 2;
    if (swaps) swap(s[n - 1], s[n - 2]);
    if (s == t) {
      cout << "YES" << endl;
    } else
      cout << "NO" << endl;
  }
}
