#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483647;
const int N = 2005;
int z, n, k, c, i, ind, tab[N];
char t[N];
string s;
vector<pair<int, int> > v;
void sett(int val, int ind) {
  if (tab[ind] == val) return;
  int i = ind + 1;
  while (tab[i] != val) i++;
  v.push_back(pair<int, int>(ind, i));
  while (ind < i) {
    swap(tab[ind], tab[i]);
    ind++;
    i--;
  }
}
int main() {
  scanf("%d", &z);
  while (z--) {
    scanf("%d %d", &n, &k);
    scanf("%s", t);
    s = t;
    for (i = 0; i < n; i++)
      if (s[i] == '(')
        tab[i] = 0;
      else
        tab[i] = 1;
    v.clear();
    ind = 0;
    for (i = 0; i < k - 1; i++) {
      sett(0, ind++);
      sett(1, ind++);
    }
    c = n / 2 - k + 1;
    for (i = 0; i < c; i++) sett(0, ind++);
    for (i = 0; i < c; i++) sett(1, ind++);
    printf("%d\n", v.size());
    for (auto& w : v) printf("%d %d\n", w.first + 1, w.second + 1);
  }
  return 0;
}
