#include <bits/stdc++.h>
using namespace std;
FILE* in = stdin;
FILE* out = stdout;
const int MAX = 2002;
int n, k;
char a[MAX];
void solve() {
  vector<pair<int, int> > ans;
  int idx = 0;
  while (k > 1) {
    if (a[idx] != '(') {
      int nxt = idx + 1;
      while (a[nxt] != '(') nxt++;
      ans.push_back(make_pair(idx, nxt));
      reverse(a + idx, a + nxt + 1);
    }
    idx++;
    if (a[idx] != ')') {
      int nxt = idx + 1;
      while (a[nxt] != ')') nxt++;
      ans.push_back(make_pair(idx, nxt));
      reverse(a + idx, a + nxt + 1);
    }
    idx++;
    k--;
  }
  int rem = (n - idx) / 2;
  for (int i = 0; i < rem; i++) {
    if (a[idx + i] == '(') {
      continue;
    } else {
      int nxt = idx + i + 1;
      while (a[nxt] != '(') nxt++;
      ans.push_back(make_pair(idx + i, nxt));
      reverse(a + idx + i, a + nxt + 1);
    }
  }
  fprintf(out, "%d\n", (int)ans.size());
  for (int i = 0; i < (int)ans.size(); i++)
    fprintf(out, "%d %d\n", ans[i].first + 1, ans[i].second + 1);
}
int main(void) {
  int numTests;
  fscanf(in, "%d", &numTests);
  for (int test = 0; test < numTests; test++) {
    fscanf(in, "%d %d", &n, &k);
    fscanf(in, "%s", a);
    solve();
  }
  return 0;
}
