#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int T;
  scanf("%d", &T);
  while (T--) {
    vector<pair<int, int>> op;
    int N, K;
    scanf("%d%d", &N, &K);
    char str[2222];
    scanf("%s", str + 1);
    char aim[2222];
    memset(aim, 0, sizeof aim);
    int pointer = 1;
    for (int i = 1; i <= 2 * (K - 1); ++i) {
      if (pointer % 2)
        aim[pointer++] = '(';
      else
        aim[pointer++] = ')';
    }
    int rem = N - 2 * (K - 1);
    for (int i = 1; i <= rem / 2; ++i) aim[pointer++] = '(';
    for (int i = 1; i <= rem / 2; ++i) aim[pointer++] = ')';
    for (int i = 1; i <= N; ++i) {
      if (aim[i] == str[i]) continue;
      for (int j = i + 1; j <= N; ++j) {
        if (str[j] == aim[i]) {
          reverse(str + i, str + j + 1);
          op.push_back({i, j});
          break;
        }
      }
    }
    printf("%d\n", (int)op.size());
    for (pair<int, int> p : op) printf("%d %d\n", p.first, p.second);
  }
  return 0;
}
