#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c = getchar();
  int x = 0;
  bool f = 0;
  for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45);
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  if (f) x = -x;
  return x;
}
int n, k;
char s[200005];
vector<pair<int, int> > v;
void rev(int l, int r) {
  reverse(s + l, s + r + 1);
  v.push_back(make_pair(l, r));
}
void work() {
  n = read(), k = read(), v.clear();
  scanf("%s", s + 1);
  int l = 1, r = n;
  while (l <= r) {
    while (s[l] == '(') ++l;
    while (s[r] == ')') --r;
    if (l > r) break;
    rev(l, r);
  }
  --k;
  l = n / 2, r = n - 1;
  while (k) {
    rev(l, r);
    l--, r -= 2, k--;
  }
  cout << v.size() << endl;
  for (auto t : v) cout << t.first << ' ' << t.second << endl;
}
signed main() {
  int T = read();
  while (T--) work();
  return 0;
}
