#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:32100000")
#pragma GCC optimize("O3")
using namespace std;
void solve() {
  int n, k;
  string str;
  cin >> n >> k >> str;
  string need;
  for (int i = 0; i < k - 1; i++) {
    need += "()";
  }
  for (int i = 0; i < (n - 2 * k + 2) / 2; i++) {
    need += '(';
  }
  for (int i = 0; i < (n - 2 * k + 2) / 2; i++) {
    need += ')';
  }
  vector<pair<int, int>> ans;
  for (int i = 0; i < n; i++) {
    if (str[i] == need[i]) {
      continue;
    }
    int pos = i + 1;
    for (; pos < n && str[pos] != need[i]; pos++)
      ;
    ans.push_back({i, pos});
    for (int j = 0; j < (pos - i + 1) / 2; j++) {
      swap(str[i + j], str[pos - j]);
    }
  }
  cout << ans.size() << "\n";
  for (auto &i : ans) {
    cout << i.first + 1 << " " << i.second + 1 << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  cout.precision(9);
  srand(time(0));
  int q;
  cin >> q;
  while (q--) {
    solve();
  }
  return 0;
}
