#include <bits/stdc++.h>
using namespace std;
long long dj[] = {1, 0, -1, 0};
long long di[] = {0, 1, 0, -1};
long long fine(long long i, long long j, long long n, long long m) {
  return i >= 0 && i < n && j >= 0 && j < m;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long k;
  cin >> k;
  for (; k; k--) {
    long long n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    map<char, queue<long long>> first, second;
    long long cnt = 0;
    for (long long i = 0; i < n; i++) {
      if (s[i] != t[i]) {
        first[s[i]].push(i);
        second[t[i]].push(i);
      }
    }
    long long f = 1;
    queue<pair<long long, long long>> ans;
    for (long long i = 0; i < n; i++) {
      if (s[i] != t[i]) {
        long long check = 0;
        for (long long j = i + 1; j < n; j++) {
          if (s[i] == s[j] && s[j] != t[j]) {
            ans.push({j, i});
            check = 1;
            swap(t[i], s[j]);
            break;
          }
        }
        if (!check) {
          for (long long j = i + 1; j < n; j++) {
            if (t[j] == s[i] && t[j] != s[j]) {
              ans.push({j, j});
              check = 1;
              swap(s[j], t[j]);
              i--;
              break;
            }
          }
        }
        if (!check) {
          f = 0;
          break;
        }
      }
    }
    if (f && ans.size() <= 2 * n) {
      cout << "Yes\n";
      cout << ans.size() << '\n';
      while (ans.size()) {
        cout << ans.front().first + 1 << " " << ans.front().second + 1 << '\n';
        ans.pop();
      }
    } else
      cout << "No\n";
  }
}

### Prompt

In cpp, your task is to solve the following problem:

This problem is different from the easy version. In this version Ujan makes at most 2n swaps. In addition, k ≤ 1000, n ≤ 50 and it is necessary to print swaps themselves. You can hack this problem if you solve it. But you can hack the previous problem only if you solve both problems.

After struggling and failing many times, Ujan decided to try to clean up his house again. He decided to get his strings in order first.

Ujan has two distinct strings s and t of length n consisting of only of lowercase English characters. He wants to make them equal. Since Ujan is lazy, he will perform the following operation at most 2n times: he takes two positions i and j (1 ≤ i,j ≤ n, the values i and j can be equal or different), and swaps the characters s_i and t_j.

Ujan's goal is to make the strings s and t equal. He does not need to minimize the number of performed operations: any sequence of operations of length 2n or shorter is suitable.

Input

The first line contains a single integer k (1 ≤ k ≤ 1000), the number of test cases.

For each of the test cases, the first line contains a single integer n (2 ≤ n ≤ 50), the length of the strings s and t. 

Each of the next two lines contains the strings s and t, each having length exactly n. The strings consist only of lowercase English letters. It is guaranteed that strings are different.

Output

For each test case, output "Yes" if Ujan can make the two strings equal with at most 2n operations and "No" otherwise. You can print each letter in any case (upper or lower).

In the case of "Yes" print m (1 ≤ m ≤ 2n) on the next line, where m is the number of swap operations to make the strings equal. Then print m lines, each line should contain two integers i, j (1 ≤ i, j ≤ n) meaning that Ujan swaps s_i and t_j during the corresponding operation. You do not need to minimize the number of operations. Any sequence of length not more than 2n is suitable.

Example

Input


4
5
souse
houhe
3
cat
dog
2
aa
az
3
abc
bca


Output


Yes
1
1 4
No
No
Yes
3
1 2
3 1
2 3

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long dj[] = {1, 0, -1, 0};
long long di[] = {0, 1, 0, -1};
long long fine(long long i, long long j, long long n, long long m) {
  return i >= 0 && i < n && j >= 0 && j < m;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long k;
  cin >> k;
  for (; k; k--) {
    long long n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    map<char, queue<long long>> first, second;
    long long cnt = 0;
    for (long long i = 0; i < n; i++) {
      if (s[i] != t[i]) {
        first[s[i]].push(i);
        second[t[i]].push(i);
      }
    }
    long long f = 1;
    queue<pair<long long, long long>> ans;
    for (long long i = 0; i < n; i++) {
      if (s[i] != t[i]) {
        long long check = 0;
        for (long long j = i + 1; j < n; j++) {
          if (s[i] == s[j] && s[j] != t[j]) {
            ans.push({j, i});
            check = 1;
            swap(t[i], s[j]);
            break;
          }
        }
        if (!check) {
          for (long long j = i + 1; j < n; j++) {
            if (t[j] == s[i] && t[j] != s[j]) {
              ans.push({j, j});
              check = 1;
              swap(s[j], t[j]);
              i--;
              break;
            }
          }
        }
        if (!check) {
          f = 0;
          break;
        }
      }
    }
    if (f && ans.size() <= 2 * n) {
      cout << "Yes\n";
      cout << ans.size() << '\n';
      while (ans.size()) {
        cout << ans.front().first + 1 << " " << ans.front().second + 1 << '\n';
        ans.pop();
      }
    } else
      cout << "No\n";
  }
}

```