#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  string t(n, '?');
  for (int i = 0; i < k - 1; ++i) {
    t[2 * i] = '(';
    t[2 * i + 1] = ')';
  }
  for (int i = 0; i <= n / 2 - k; ++i) {
    t[2 * k - 2 + i] = '(';
    t[n - 1 - i] = ')';
  }
  vector<pair<int, int>> A;
  for (int i = 0; i < n; ++i) {
    if (s[i] == t[i]) continue;
    int l = i, r = -1;
    for (int j = i + 1; j < n; ++j) {
      if (s[j] == t[i]) {
        r = j;
        break;
      }
    }
    assert(r >= 0);
    reverse(s.begin() + l, s.begin() + r + 1);
    A.emplace_back(l + 1, r + 1);
  }
  cout << A.size() << endl;
  for (auto p : A) cout << p.first << " " << p.second << endl;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
