#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << endl;
  err(++it, args...);
}
const int mod = 1e9 + 7;
string s;
vector<pair<int, int> > ans;
void rev(int i, char ch) {
  for (int j = i + 1; j < ((int)(s).size()); j++) {
    if (s[j] == ch) {
      reverse(s.begin() + i, s.begin() + j + 1);
      ans.push_back({i + 1, j + 1});
      break;
    }
  }
}
void solve() {
  int n, k;
  cin >> n >> k;
  cin >> s;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (cnt == k - 1) {
      int j = i;
      for (j = i; j < i + (n - i) / 2; j++) {
        if (s[j] == ')') rev(j, '(');
      }
      for (; j < n; j++) {
        if (s[j] == '(') rev(j, ')');
      }
      break;
    } else {
      if (i % 2 == 0) {
        if (s[i] == ')') rev(i, '(');
      } else {
        if (s[i] == '(') rev(i, ')');
        cnt++;
      }
    }
  }
  cout << ((int)(ans).size()) << "\n";
  for (auto i : ans) cout << i.first << " " << i.second << "\n";
  ans.clear();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int tt;
  cin >> tt;
  while (tt--) solve();
}
