#include <bits/stdc++.h>
using namespace std;
void op(string &s, int l, int r) {
  while (l < r) {
    swap(s[l++], s[r--]);
  }
}
char par[] = {'(', ')'};
void solve() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<pair<int, int> > ans;
    int needed = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] != par[needed]) {
        for (int j = i + 1; j < n; j++) {
          if (s[j] == par[needed]) {
            op(s, i, j);
            ans.push_back({i + 1, j + 1});
            break;
          }
        }
      }
      if (k == 1) {
        needed = 0;
        k = 0;
      } else {
        needed ^= 1;
      }
      if (s[i] == ')') {
        k--;
      }
    }
    cout << ans.size() << '\n';
    ;
    for (auto j : ans) {
      cout << j.first << " " << j.second << '\n';
      ;
    }
  }
}
int main() {
  solve();
  getchar();
  getchar();
}
