#include <bits/stdc++.h>
#pragma GCC optimize("-O3")
#pragma GCC target("avx2")
using namespace std;
string s;
int n;
vector<pair<int, int> > v;
void f(int l, char sk) {
  if (s[l] == sk) {
    return;
  }
  int ind;
  for (ind = l + 1; ind < n; ind++) {
    if (s[ind] == sk) {
      break;
    }
  }
  v.push_back(make_pair(l + 1, ind + 1));
  reverse(s.begin() + l, s.begin() + ind + 1);
  return;
}
int main() {
  cin.tie(NULL);
  int query;
  cin >> query;
  int k, ind = 0, x;
  for (int aaa = 0; aaa < query; aaa++) {
    v.clear();
    v.resize(0);
    cin >> n >> k >> s;
    ind = 0;
    for (int i = 0; i < k - 1; i++) {
      f(ind, '(');
      ind++;
      f(ind, ')');
      ind++;
    }
    for (int i = 0; i < n / 2 - k + 1; i++) {
      f(ind, '(');
      ind++;
    }
    for (int i = 0; i < n / 2 - k + 1; i++) {
      f(ind, ')');
      ind++;
    }
    x = int(v.size());
    cout << x << "\n";
    for (int i = 0; i < x; i++) {
      cout << v[i].first << " " << v[i].second << "\n";
    }
  }
  return 0;
}
