#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<pair<long long int, long long int>> ans;
  string des = "";
  for (long long int i = 1; i < k; i++) {
    des += "()";
  }
  long long int maxx = (n / 2);
  for (long long int i = 0; i < (maxx - k + 1); i++) {
    des += "(";
  }
  for (long long int i = 0; i < (maxx - k + 1); i++) {
    des += ")";
  }
  for (long long int i = 0; i < n; i++) {
    if (s[i] != des[i]) {
      long long int j = i + 1;
      while (s[j] != des[i]) j++;
      string temp = s.substr(i, (j - i + 1));
      reverse(temp.begin(), temp.end());
      for (long long int k = i; k <= j; k++) {
        s[k] = temp[k - i];
      }
      ans.push_back({i + 1, j + 1});
    }
  }
  cout << ans.size() << "\n";
  for (long long int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << "\n";
  }
}
signed main() {
  long long int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
