#include <bits/stdc++.h>
using namespace std;
struct trip {
  int a, b, c;
};
const int INF = 0x3f3f3f3f;
const long long INFLL = 1e18;
const int MOD = 1e9 + 7;
const int MAXINT = 1e5 + 1;
int t;
string solution(int n, int k) {
  int parentesis = k - 1;
  string r = "";
  while (parentesis--) r += "()";
  int rest = n / 2 - k + 1;
  for (int i = 0; i < rest; i++) r += "(";
  for (int i = 0; i < rest; i++) r += ")";
  return r;
}
void testCase() {
  int n, k;
  string s, t;
  vector<pair<int, int>> sol;
  cin >> n >> k >> s;
  t = solution(n, k);
  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]) {
          sol.push_back({i, j});
          for (int k = i; k < (i + j) / 2 + 1; k++) swap(s[k], s[j - k + i]);
          break;
        }
  cout << sol.size() << endl;
  for (auto e : sol) cout << e.first + 1 << " " << e.second + 1 << endl;
}
int main() {
  cin >> t;
  while (t--) testCase();
  return 0;
}
