#include <bits/stdc++.h>
using namespace std;
int T, n, k, OA[2234], OB[2234], cnt;
char ch[2234];
void find(int x, char t) {
  int L = x, R = x;
  for (R = x + 1; R <= n; R++)
    if (ch[R] == t) break;
  OA[++cnt] = L;
  OB[cnt] = R;
  for (; L < R; L++, R--) swap(ch[L], ch[R]);
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d\n", &n, &k);
    scanf("%s", ch + 1);
    k = (n >> 1) - k;
    cnt = 0;
    if (ch[1] != '(') find(1, '(');
    for (int i = 1; i <= k; i++) {
      if (ch[i << 1] != '(') find(i << 1, '(');
      if (ch[i << 1 | 1] != ')') find(i << 1 | 1, ')');
    }
    if (ch[(k + 1) << 1] != ')') find((k + 1) << 1, ')');
    for (int i = (k + 1); i < (n >> 1); i++) {
      if (ch[i << 1 | 1] != '(') find(i << 1 | 1, '(');
      if (ch[(i + 1) << 1] != ')') find((i + 1) << 1, ')');
    }
    printf("%d\n", cnt);
    for (int i = 1; i <= cnt; i++) printf("%d %d\n", OA[i], OB[i]);
  }
  return 0;
}
