#include <bits/stdc++.h>
using namespace std;
char s[200001];
char t[200001];
int at1[206], at2[206];
int cnt[206], cnt2[206];
int num[26];
signed main() {
  int T;
  cin >> T;
  while (T--) {
    int n;
    scanf("%d", &n);
    cin >> s + 1;
    cin >> t + 1;
    memset(num, 0, sizeof(num));
    memset(cnt, 0, sizeof(cnt));
    memset(cnt2, 0, sizeof(cnt2));
    memset(at1, 0, sizeof(at1));
    memset(at2, 0, sizeof(at2));
    for (int i = 1; i <= n; i++) cnt[s[i] - 'a']++, at1[s[i] - 'a'] = i;
    for (int i = 1; i <= n; i++) cnt2[t[i] - 'a']++, at2[t[i] - 'a'] = i;
    int flag = 0;
    for (int i = 1; i <= 26; i++)
      if (cnt[i - 1] != cnt2[i - 1]) {
        printf("NO\n");
        flag = 1;
        break;
      }
    if (flag) continue;
    for (int i = 1; i <= 26; i++)
      if (cnt[i - 1] >= 2) {
        printf("YES\n");
        flag = 1;
        break;
      }
    if (flag) continue;
    int tot = 0;
    for (int i = 1; i <= n; i++) num[s[i] - 'a'] = i;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= i; j++)
        if (num[t[j] - 'a'] > num[t[i] - 'a']) tot++;
    }
    if (tot % 2 == 1)
      printf("NO\n");
    else
      printf("YES\n");
  }
  return 0;
}
