#include <bits/stdc++.h>
using namespace std;
struct re {
  int x, y;
};
const int inf = 1e9 + 10;
const int N = 1e3 + 10;
int n, k, T;
string s;
vector<pair<int, int> > ans;
void rv(int x, int y) {
  for (int i = x; i <= (y + x) / 2; ++i) swap(s[i], s[y - (i - x)]);
}
void solve() {
  ans.clear();
  cin >> n >> k >> s;
  for (int i = 0; i < n; ++i) {
    if (k == 1) {
      for (int j = i; j < n; ++j)
        if (s[j] == ')')
          for (int k = j + 1; k < n; ++k)
            if (s[k] == '(') {
              rv(j, k);
              ans.push_back(make_pair(j, k));
              break;
            }
      break;
    }
    if (i == 0 || s[i - 1] == ')') {
      if (s[i] == ')')
        for (int j = i + 1; j < n; ++j)
          if (s[j] == '(') {
            rv(i, j);
            ans.push_back(make_pair(i, j));
            break;
          }
    } else {
      if (s[i] == '(')
        for (int j = i + 1; j < n; ++j)
          if (s[j] == ')') {
            rv(i, j);
            ans.push_back(make_pair(i, j));
            break;
          }
      --k;
    }
  }
  cout << ans.size() << '\n';
  for (auto i : ans) cout << i.first + 1 << ' ' << i.second + 1 << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> T;
  while (T--) {
    solve();
  }
  return 0;
}
