#include <bits/stdc++.h>
using namespace std;
void Evolution();
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    Evolution();
  }
  return 0;
}
void Evolution() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  string good = s;
  for (int i = 0; i < k - 1; i++) {
    good[2 * i] = '(';
    good[2 * i + 1] = ')';
  }
  for (int i = 0; i < n / 2 + 1 - k; i++) {
    good[2 * k - 2 + i] = '(';
    good[n - 1 - i] = ')';
  }
  vector<pair<int, int> > op;
  for (int i = 0; i < n; i++) {
    if (s[i] != good[i]) {
      int j = i + 1;
      while (s[j] != good[i] && j < n - 1) j++;
      for (int z = 0; z < (j - i + 1) / 2; z++) {
        char temp = s[i + z];
        s[i + z] = s[j - z];
        s[j - z] = temp;
      }
      op.push_back({i + 1, j + 1});
    }
  }
  int sz = op.size();
  cout << sz << "\n";
  for (int i = 0; i < sz; i++) {
    cout << op[i].first << " " << op[i].second << "\n";
  }
}
