#include <bits/stdc++.h>
using namespace std;
int n, k;
int fie[2005];
int best[2005];
void solve() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    char c;
    scanf(" %c", &c);
    if (c == '(') {
      fie[i] = 0;
    } else {
      fie[i] = 1;
    }
  }
  int pos = 0;
  for (int i = 0; i < (n - (k - 1) * 2) / 2; i++) {
    best[pos++] = 0;
  }
  for (int i = 0; i < (n - (k - 1) * 2) / 2; i++) {
    best[pos++] = 1;
  }
  for (int i = 0; i < k - 1; i++) {
    best[pos++] = 0;
    best[pos++] = 1;
  }
  vector<pair<int, int> > ans;
  for (int i = 0; i < n; i++) {
    if (best[i] != fie[i]) {
      int j = i;
      while (j < n) {
        if (fie[j] == best[i]) break;
        j++;
      }
      int len = (j - i + 1) / 2;
      for (int k = 0; k < len; k++) {
        swap(fie[i + k], fie[j - k]);
      }
      ans.push_back(pair<int, int>(i + 1, j + 1));
    }
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++) {
    printf("%d %d\n", ans[i].first, ans[i].second);
  }
}
int main(void) {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
