#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool isPrime(long long int n) {
  if (n <= 1) return false;
  for (long long int i = 2; i <= sqrt(n); ++i) {
    if (n % i == 0) return false;
  }
  return true;
}
long long int modExp(long long int b, long long int e, long long int mod) {
  long long int res = 1;
  while (e > 0) {
    if (e & 1) res = res * b % mod;
    b = b * b % mod;
    e >>= 1;
  }
  return res % mod;
}
long long int factorial(long long int n) {
  long long int r = 1;
  for (long long int i = 1; i <= n; ++i) {
    r *= i;
  }
  return r;
}
int t, n, k;
string s;
int main() {
  cin >> t;
  while (t--) {
    cin >> n >> k >> s;
    long long int m = 0;
    string perfect = "";
    for (int i = 0; i < k - 1; ++i) perfect += "()";
    int rem = n - 2 * (k - 1);
    for (int i = 0; i < rem / 2; ++i) perfect += "(";
    for (int i = 0; i < rem / 2; ++i) perfect += ")";
    vector<pair<int, int>> ops;
    int i = 0;
    while (i < perfect.size()) {
      if (perfect[i] != s[i]) {
        int k = i + 1;
        while (s[k] != perfect[i]) ++k;
        int j = i;
        ops.push_back(make_pair(j + 1, k + 1));
        while (j < k) {
          swap(s[j++], s[k--]);
        }
        ++m;
      }
      ++i;
    }
    cout << m << endl;
    for (int j = 0; j < ops.size(); ++j)
      cout << ops[j].first << " " << ops[j].second << endl;
  }
  return 0;
}
