#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
char ch[2005];
vector<pair<int, int> > v;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    v.clear();
    int n, k;
    scanf("%d%d", &n, &k);
    scanf("%s", ch);
    string s = ch;
    string sol = "";
    for (int i = 0; i < k - 1; i++) sol += "()";
    for (int i = 0; i <= (s.size() - 2 * k) / 2; i++) sol += "(";
    for (int i = 0; i <= (s.size() - 2 * k) / 2; i++) sol += ")";
    for (int i = 0; i < s.size(); i++) {
      int pos = i;
      char c = sol[i];
      for (; s[pos] != c; pos++)
        ;
      if (pos != i) {
        v.push_back(make_pair(i + 1, pos + 1));
        reverse(s.begin() + i, s.begin() + pos + 1);
      }
    }
    printf("%d\n", v.size());
    for (int i = 0; i < v.size(); i++) {
      printf("%d %d\n", v[i].first, v[i].second);
    }
  }
  return 0;
}
