#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 5;
template <class T>
void print(T& x) {
  cout << x;
}
template <class T, class U>
void print(pair<T, U>& p) {
  cout << "(";
  print(p.first);
  cout << ", ";
  print(p.second);
  cout << ")";
}
template <class T>
void print(vector<T>& v) {
  cout << "{";
  if (((int)(v).size())) print(v[0]);
  for (int i = 1; i < ((int)(v).size()); i++) cout << ", ", print(v[i]);
  cout << "}\n";
}
int n, m, T;
string a, b;
vector<pair<int, int> > ans;
string doit(string a, int l, int r) {
  string ret = a.substr(l, r - l + 1);
  reverse(ret.begin(), ret.end());
  string k = a.substr(0, l) + ret + a.substr(r + 1);
  return k;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> T;
  while (T--) {
    cin >> n >> m;
    cin >> a;
    ans.clear();
    b = "";
    for (int i = 1; i <= m - 1; ++i) b += "()";
    b += "(";
    for (int i = 1; i <= (n - 2 * m) / 2; ++i) b += "()";
    b += ")";
    for (int i = 0; i < n; ++i)
      if (a[i] != b[i]) {
        int todo = i;
        for (int j = n - 1; j >= i; --j) {
          if (a[j] == b[i]) {
            todo = j;
            break;
          }
        }
        a = doit(a, i, todo);
        ans.push_back({i + 1, todo + 1});
      }
    cout << ((int)(ans).size()) << endl;
    for (auto [x, y] : ans) {
      cout << x << " " << y << endl;
    }
  }
  return 0;
}
