#include <bits/stdc++.h>
using namespace std;
int lsone(int n) { return (n & -n); }
long long int pow1(long long int a, long long int b) {
  if (b == 0)
    return 1ll;
  else if (b == 1)
    return a;
  else {
    long long int x = pow1(a, b / 2);
    x *= x;
    x %= 1000000007;
    if (b % 2) {
      x *= a;
      x %= 1000000007;
    }
    return x;
  }
}
int tests, n, k;
string s, t;
vector<pair<int, int> > ans;
void rev(int x, int y) {
  int p1 = x, p2 = y;
  while (p1 < p2) {
    char temp = s[p1];
    s[p1] = s[p2];
    s[p2] = temp;
    p1++;
    p2--;
  }
}
void needed(int x) {
  t = "";
  for (int i = 0; i < x - 1; i++) {
    t += "()";
  }
  int lef = s.size() - t.size();
  for (int i = 0; i < lef / 2; i++) t += "(";
  for (int i = 0; i < lef / 2; i++) t += ")";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> tests;
  while (tests--) {
    cin >> n >> k;
    cin >> s;
    ans.clear();
    needed(k);
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == t[i]) continue;
      for (int j = i + 1; j < s.size(); j++) {
        if (s[j] == t[i]) {
          rev(i, j);
          ans.push_back(make_pair(i + 1, j + 1));
          break;
        }
      }
    }
    cout << ans.size() << "\n";
    for (auto p : ans) {
      cout << p.first << " " << p.second << "\n";
    }
  }
  return 0;
}
