#include <bits/stdc++.h>
using namespace std;
template <class T>
using max_pq = priority_queue<T>;
template <class T>
using min_pq = priority_queue<T, vector<T>, greater<T> >;
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream second(s);
  string x;
  while (getline(second, x, c)) v.emplace_back(x);
  return move(v);
}
template <typename T, typename... Args>
inline string arrStr(T arr, long long n) {
  stringstream s;
  s << "[";
  for (long long i = 0; i < n - 1; i++) s << arr[i] << ",";
  if (n > 0) s << arr[n - 1];
  s << "]";
  return s.str();
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long countinv(string str, long long n) {
  long long ans = 0;
  long long count[26];
  for (long long i = 0; i < 26; i++) count[i] = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < (str[i] - 'a'); j++) {
      ans += count[j];
    }
    count[str[i] - 'a']++;
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long testcases;
  cin >> testcases;
  for (long long test = 1; test <= testcases; test++) {
    long long n;
    string s, t;
    cin >> n >> s >> t;
    long long count1[26], count2[26];
    for (long long i = 0; i < 26; i++) {
      count1[i] = count2[i] = 0;
    }
    for (long long i = 0; i < n; i++) {
      count1[s[i] - 'a']++;
      count2[t[i] - 'a']++;
    }
    long long flag = 0, g = 0;
    for (long long i = 0; i < 26; i++) {
      if (count1[i] != count2[i]) {
        flag = 1;
      }
      if (count1[i] > 1) {
        g = 1;
      }
    }
    if (flag) {
      cout << "NO\n";
      continue;
    }
    if (g) {
      cout << "YES\n";
      continue;
    }
    long long c1 = countinv(s, s.size()), c2 = countinv(t, t.size());
    __f("test, c1, c2", test, c1, c2);
    if (c1 % 2 == c2 % 2) {
      cout << "YES";
    } else {
      cout << "NO";
    }
    cout << "\n";
  }
  return 0;
}
