#include <bits/stdc++.h>
using namespace std;
template <typename U, typename V>
void Min(U &a, const V &b) {
  if (a > b) a = b;
}
template <typename U, typename V>
void Max(U &a, const V &b) {
  if (a < b) a = b;
}
template <typename U, typename V>
void add(U &a, const V &b) {
  a = (a + b) % 1000000007;
}
template <typename U>
U gcd(U a, U b) {
  if (a == 0) return b;
  if (b == 0) return a;
  if (a >= b)
    return gcd(a % b, b);
  else
    return gcd(a, b % a);
}
int pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % 1000000007;
    a = 1LL * a * a % 1000000007;
    b >>= 1;
  }
  return ans;
}
int pow(int a, int b, int c) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % c;
    a = 1LL * a * a % c;
    b >>= 1;
  }
  return ans;
}
char s[2005];
vector<pair<int, int> > ans;
void solve(int l, int r, int K) {
  if (l > r) return;
  if (s[l] != '(') {
    for (int i = r + 1 - 1; i >= l + 1; i--)
      if (s[i] == '(') {
        reverse(s + l, s + i + 1);
        ans.push_back({l, i});
        break;
      }
  }
  if (s[r] != ')') {
    for (int i = l + 1; i < r; i++)
      if (s[i] == ')') {
        reverse(s + i, s + r + 1);
        ans.push_back({i, r});
        break;
      }
  }
  if (l + 1 == r) return;
  if (K == 0) {
    int m = (l + r + 1) >> 1;
    int k = r - 1;
    for (int i = l + 1; i < m; i++)
      if (s[i] != '(') {
        while (k > i && s[k] == ')') k--;
        reverse(s + i, s + k + 1);
        ans.push_back({i, k});
      }
  } else {
    if (s[l + 1] != ')') {
      for (int i = l + 2; i < r; i++)
        if (s[i] == ')') {
          reverse(s + l + 1, s + i + 1);
          ans.push_back({l + 1, i});
          break;
        }
    }
    solve(l, l + 1, 1);
    solve(l + 2, r, K - 1);
  }
}
int main() {
  int T, i, j, k, m, ca = 0, n, K;
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d%s", &n, &K, s);
    K--;
    ans.clear();
    solve(0, n - 1, K);
    printf("%d\n", int(ans.size()));
    for (auto &o : ans) printf("%d %d\n", o.first + 1, o.second + 1);
  }
}
