#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  string t = "";
  string l = "()";
  int auxk = k;
  while (auxk > 1) {
    t += l;
    auxk--;
  }
  int szt = t.size();
  for (int i = 0; i < (n - szt) / 2; i++) t += '(';
  for (int i = 0; i < (n - szt) / 2; i++) t += ')';
  vector<pair<int, int> > ans;
  for (int i = 0; i < n; i++) {
    if (s[i] != t[i]) {
      for (int j = i + 1; j < n; j++) {
        if (s[j] == t[i]) {
          int a = i, b = j;
          while (a <= b) {
            swap(s[a], s[b]);
            a++;
            b--;
          }
          ans.push_back(pair<int, int>(i + 1, j + 1));
          break;
        }
      }
    }
  }
  cout << ans.size() << '\n';
  for (auto &e : ans) {
    cout << e.first << " " << e.second << '\n';
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
