#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
ifstream in("in.in");
const int INF = 1e9;
void speed_up() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
void loop() {
  int n, k;
  string s;
  cin >> n >> k >> s;
  int i = 0;
  vector<pii> ans;
  for (i = 0; i < n && k > 1; i++) {
    if (s[i] == ')') {
      if (i > 0 && s[i - 1] == '(') {
        k--;
        continue;
      }
      int j = i;
      while (s[j] != '(') {
        j++;
      }
      reverse(s.begin() + i, s.begin() + j + 1);
      ans.push_back({i + 1, j + 1});
    } else {
      if (i > 0 && s[i - 1] == '(') {
        int j = i;
        while (s[j] != ')') {
          j++;
        }
        reverse(s.begin() + i, s.begin() + j + 1);
        ans.push_back({i + 1, j + 1});
        k--;
      }
    }
  }
  int j = n - 1;
  while (i < j) {
    while (s[i] == '(') {
      i++;
    }
    while (s[j] == ')') {
      j--;
    }
    if (i >= j) {
      continue;
    }
    reverse(s.begin() + i, s.begin() + j + 1);
    ans.push_back({i + 1, j + 1});
    i++, j--;
  }
  cout << ans.size() << "\n";
  for (pii p : ans) {
    cout << p.first << " " << p.second << "\n";
  }
}
signed main() {
  speed_up();
  int t;
  cin >> t;
  while (t--) {
    loop();
  }
  return 0;
}
