#include <bits/stdc++.h>
using namespace std;
const int maxn = 2200;
const int mod = 1e9 + 7;
char str[maxn];
queue<pair<int, int> > que;
void rev(int l, int r);
int main() {
  int t, n, m, i, j, k, op, num;
  char ch1, ch2;
  scanf("%d", &t);
  while (t--) {
    scanf("%d %d %s", &n, &k, str);
    num = 0, m = n / 2 - k + 1;
    for (i = 0; i < n; i += 2) {
      if (num < k - 1)
        ch1 = '(', ch2 = ')';
      else
        break;
      for (j = i; j < n; j++)
        if (str[j] == ch1) break;
      que.push(pair<int, int>(i, j));
      rev(i, j);
      for (j = i + 1; j < n; j++)
        if (str[j] == ch2) break;
      que.push(pair<int, int>(i + 1, j));
      rev(i + 1, j);
      num++;
    }
    for (i = (k - 1) * 2; i < n - m; i++) {
      for (j = i; j < n; j++)
        if (str[j] == '(') break;
      que.push(pair<int, int>(i, j));
      rev(i, j);
    }
    for (; i < n; i++) {
      for (j = i; j < n; j++)
        if (str[j] == ')') break;
      que.push(pair<int, int>(i, j));
      rev(i, j);
    }
    printf("%d\n", n);
    while (!que.empty()) {
      pair<int, int> p = que.front();
      que.pop();
      printf("%d %d\n", p.first + 1, p.second + 1);
    }
  }
  return 0;
}
void rev(int l, int r) {
  for (int i = 0; l + i <= r - i; i++) swap(str[l + i], str[r - i]);
}
