#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  string a;
  cin >> a;
  string b = "";
  for (int i = 1; i <= k - 1; i++) {
    b += '(';
    b += ')';
  }
  int m = n - 2 * (k - 1);
  for (int i = 1; i <= m / 2; i++) b += '(';
  for (int i = 1; i <= m / 2; i++) b += ')';
  vector<pair<int, int> > s;
  for (int i = 0; i < n; i++)
    if (a[i] != b[i]) {
      int j = i + 1;
      while (j != n && a[j] != b[i]) j++;
      int x = j - i + 1;
      for (int z = 0; z < x / 2; z++) {
        char sw = a[i + z];
        a[i + z] = a[j - z];
        a[j - z] = sw;
      }
      s.push_back({i + 1, j + 1});
    }
  cout << s.size() << endl;
  for (int i = 0; i < s.size(); i++) {
    int mn = min(s[i].first, s[i].second);
    int mx = max(s[i].first, s[i].second);
    cout << mn << " " << mx << endl;
  }
}
int main() {
  int q;
  cin >> q;
  for (int t = 0; t < q; t++) solve();
}
