#include <bits/stdc++.h>
using namespace std;
void reverse(string &s1, int start, int end) {
  while (start < end) swap(s1[start++], s1[end--]);
  return;
}
void compPrefMaker(string &s1, vector<pair<int, int> > &res, int n) {
  for (int i = 0; i < n; i += 2) {
    int j = i + 1;
    if (s1[i] == '(') {
      while (s1[j] == '(') j++;
      reverse(s1, i + 1, j);
      res.push_back(pair<int, int>(i + 1, j));
    } else {
      while (s1[j] == ')') j++;
      reverse(s1, i, j);
      res.push_back(pair<int, int>(i, j));
    }
  }
}
void kPref(vector<pair<int, int> > &res, string s1, int n, int k) {
  if (2 * k - 1 <= n - 2) res.push_back(pair<int, int>(2 * k - 1, n - 2));
  return;
}
int main() {
  int q, n, k;
  cin >> q;
  while (q--) {
    cin >> n >> k;
    string s1;
    cin >> s1;
    vector<pair<int, int> > res;
    compPrefMaker(s1, res, n);
    kPref(res, s1, n, k);
    cout << res.size() << endl;
    for (int i = 0; i < res.size(); i++)
      cout << res[i].first + 1 << " " << res[i].second + 1 << endl;
  }
  return 0;
}
