#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long double PI = acosl(-1);
const long long infl = 1e15;
const int inf = 2e9;
const int nmax = 5e5 + 10;
const int MAXLG = log2(nmax) + 1;
pair<int, int> findddd(string &s, int idx, char ch) {
  int idx2 = -1;
  for (int i = idx; i < s.size(); i++) {
    if (s[i] == ch) {
      idx2 = i;
      break;
    }
  }
  if (idx2 == -1) return {-1, -1};
  pair<int, int> ret = {idx + 1, idx2 + 1};
  while (idx < idx2) swap(s[idx++], s[idx2--]);
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int tc;
  cin >> tc;
  while (tc--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    k--;
    vector<pair<int, int> > ans;
    int idx = -1;
    for (int i = 0; i < n; i++) {
      if (k == 0) break;
      if (i % 2 == 0)
        ans.push_back(findddd(s, i, '('));
      else
        ans.push_back(findddd(s, i, ')')), k--;
      idx = i;
    }
    for (int i = idx + 1; i < n; i++) {
      pair<int, int> z = findddd(s, i, '(');
      if (z.first != -1)
        ans.push_back(z);
      else
        ans.push_back(findddd(s, i, ')'));
    }
    cout << ans.size() << "\n";
    for (auto z : ans) cout << z.first << " " << z.second << "\n";
  }
}
