#include <bits/stdc++.h>
using namespace std;
struct msp {
  int l, r;
} ans[30100];
int main() {
  std::ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int l = 0;
    for (int i = 0; i < n; i += 1) {
      if (s[i] == '(') {
        ++l;
        ans[l] = {l, i + 1};
      }
    }
    int m = n / 2;
    for (int i = 1; i < k; i += 1) {
      ans[++l] = {m - i + 1, n - i - i + 1};
    }
    cout << l << '\n';
    for (int i = 1; i <= l; i += 1) {
      cout << ans[i].l << ' ' << ans[i].r << '\n';
    }
  }
  return 0;
}
