#include <bits/stdc++.h>
using namespace std;
string a;
vector<pair<int, int> > ans;
void solvefor(int i, char ta) {
  if (a[i] == ta) return;
  int j = i;
  for (; i < a.size(); i++) {
    if (a[i] == ta) {
      reverse(a.begin() + j, a.begin() + i + 1);
      ans.push_back({j, i});
      return;
    }
  }
  return;
}
void solve() {
  int n, q;
  cin >> n >> q >> a;
  int i = 0;
  while (q != 1) {
    solvefor(i, '(');
    solvefor(i + 1, ')');
    i += 2;
    q--;
  }
  for (int j = i; j < n; j++) {
    if (a[j] == '(' && j == i) {
      i++;
      continue;
    }
    if (a[j] == '(' && j != i) {
      ans.push_back({i, j});
      i++;
    }
  }
  cout << ans.size() << endl;
  for (pair<int, int> e : ans)
    cout << e.first + 1 << " " << e.second + 1 << endl;
  vector<pair<int, int> >().swap(ans);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
