#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000 + 10;
char str[maxn];
vector<pair<int, int> > ans;
int main() {
  int n, k;
  int T;
  cin >> T;
  while (T--) {
    cin >> n >> k;
    cin >> (str + 1);
    ans.clear();
    for (int p = 1; p <= n; ++p) {
      int d = p;
      char sp;
      if (p % 2 == 1 && k)
        sp = '(';
      else if (!k)
        sp = '(';
      else
        sp = ')';
      while (d <= n && str[d] != sp) d++;
      if (d == n + 1) {
        sp = ')';
        d = p;
        while (d <= n && str[d] != sp) d++;
      }
      ans.push_back(make_pair(p, d));
      reverse(str + p, str + d + 1);
      if (p % 2 == 1 && k) k--;
    }
    cerr << (str + 1) << endl;
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); ++i) {
      cout << ans[i].first << " " << ans[i].second << endl;
    }
  }
  return 0;
}
