#include <bits/stdc++.h>
using namespace std;
void rev(int a, int b, string& s) {
  for (int ii = a; ii <= (a + b) / 2; ii++) {
    swap(s[ii], s[b - (ii - a)]);
  }
}
void solve() {
  long long n, k;
  string s;
  vector<pair<int, int> > ans;
  cin >> n >> k >> s;
  char op = '(';
  for (int i = 0; i < (k - 1) * 2; i++) {
    if (op == s[i]) {
      op = (op == '(' ? ')' : '(');
    } else {
      int nextPos = i + 1;
      for (int i1 = i + 1; i1 < s.size(); i1++) {
        if (s[i1] == op) {
          nextPos = i1;
          break;
        }
      }
      ans.push_back({i, nextPos});
      rev(i, nextPos, s);
      op = (op == '(' ? ')' : '(');
    }
  }
  op = '(';
  int ost = n - ((k - 1) * 2);
  for (int i = (k - 1) * 2; i < (k - 1) * 2 + ost / 2; i++) {
    if (s[i] == ')') {
      int nextPos = i + 1;
      for (int i1 = i + 1; i1 < s.size(); i1++) {
        if (s[i1] == op) {
          nextPos = i1;
          break;
        }
      }
      ans.push_back({i, nextPos});
      rev(i, nextPos, s);
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
  }
}
int main() {
  int q;
  cin >> q;
  while (q != 0) {
    solve();
    q--;
  }
}
