#include <bits/stdc++.h>
using namespace std;
template <typename T>
T MAX(T a, T b) {
  return (a > b) ? a : b;
}
template <typename T>
T MIN(T a, T b) {
  return (a < b) ? a : b;
}
template <typename T>
void UMAX(T &a, T b) {
  a = (a > b ? a : b);
}
template <typename T>
void UMIN(T &a, T b) {
  a = (a < b ? a : b);
}
int readint() {
  char c = getchar();
  int ret = 0;
  while (!(c >= '0' && c <= '9')) c = getchar();
  while (c >= '0' && c <= '9') {
    ret = ret * 10 + c - '0';
    c = getchar();
  }
  return ret;
}
void putint(int v) {
  if (!v) {
    putchar('0');
    return;
  }
  if (v >= 10) putint(v / 10);
  putchar('0' + (v % 10));
}
int n, m;
char readch() {
  char c = getchar();
  while (c == ' ' || c == '\n') c = getchar();
  return c;
}
int f[2005], t[2005];
void solve() {
  int i, j, k;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; ++i) {
    f[i] = (readch() == '(' ? 1 : 0);
  }
  for (i = 0; i < m - 1; ++i) {
    t[i * 2] = 1;
    t[i * 2 + 1] = 0;
  }
  int lft = (n - (m - 1) * 2) / 2;
  for (i = (m - 1) * 2; i < n; ++i) {
    if (i < (m - 1) * 2 + lft)
      t[i] = 1;
    else
      t[i] = 0;
  }
  vector<pair<int, int> > res;
  for (i = 0; i < n; ++i) {
    if (f[i] != t[i]) {
      for (j = i + 1; j < n; ++j) {
        if (f[j] == t[i]) break;
      }
      res.push_back(make_pair(i, j));
      reverse(f + i, f + j + 1);
    }
  }
  printf("%d\n", (int)res.size());
  for (i = 0; i < (int)res.size(); ++i) {
    printf("%d %d\n", res[i].first + 1, res[i].second + 1);
  }
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
  return 0;
}
