#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int MAXN = 2e3 + 5;
string str, ansstr;
int T, n, k, ans;
vector<pair<int, int>> v;
void dg(string ss, int cnt) {
  int flag = 0;
  int len = ss.size();
  for (int i = 0; i < len; i += 2) {
    if (!(ss[i] == '(' && ss[i + 1] == ')')) {
      flag = 1;
      if (ss[i] == '(') {
        for (int j = i + 1; j < len; j++) {
          if (ss[j] == ')') {
            v.push_back(make_pair(i + 2, j + 1));
            reverse(ss.begin() + i + 1, ss.begin() + j + 1);
            break;
          }
        }
      } else {
        for (int j = i + 1; j < len; j++) {
          if (ss[j] == '(') {
            v.push_back(make_pair(i + 1, j + 1));
            reverse(ss.begin() + i, ss.begin() + j + 1);
            break;
          }
        }
      }
      break;
    }
  }
  if (flag) {
    dg(ss, cnt + 1);
  } else {
    ans = cnt;
    ansstr = ss;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> T;
  while (T--) {
    v.clear();
    cin >> n >> k;
    cin >> str;
    dg(str, 0);
    if (n / 2 != k) {
      if (n == 2) {
        v.push_back(make_pair(2 * (k - 1) + 1, n - 1));
      } else {
        v.push_back(make_pair(2 * (k - 1) + 2, n - 1));
      }
    }
    cout << v.size() << endl;
    for (int i = 0; i < v.size(); i++) {
      if (v[i].first > v[i].second) {
        swap(v[i].first, v[i].second);
      }
      cout << v[i].first << ' ' << v[i].second << endl;
    }
  }
}
