#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = 500031;
int tests, n, k;
string st;
vector<pair<int, int> > ans;
string construct(int len, int k) {
  string ret;
  --k;
  for (int i = 0; i < k; i++) {
    ret += "()";
  }
  int ohead = len - 2 * k;
  for (int i = 0; i < ohead / 2; i++) {
    ret += "(";
  }
  for (int i = 0; i < ohead / 2; i++) {
    ret += ")";
  }
  return ret;
}
int main() {
  cin >> tests;
  for (; tests; --tests) {
    cin >> n >> k;
    cin >> st;
    string goal = construct(n, k);
    ans.clear();
    for (int i = 0; i < goal.size(); i++) {
      if (goal[i] != st[i]) {
        int j = i + 1;
        while (goal[i] != st[j]) ++j;
        ans.push_back(make_pair(i + 1, j + 1));
        for (int q = i; q <= j; q++) {
          if (q < (j - (q - i))) swap(st[q], st[j - (q - i)]);
        }
      }
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i].first << " " << ans[i].second << endl;
    }
  }
  return 0;
}
