#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17;
void solve() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<pair<long long, long long> > ans;
  long long cnt = 0;
  long long ind = 0;
  k--;
  for (long long i = 0; i < n; i++) {
    if (cnt == k) {
      ind = i;
      break;
    }
    if (i % 2 == 0) {
      if (s[i] == '(')
        continue;
      else {
        for (long long j = i + 1; j < n; j++) {
          if (s[j] == '(') {
            ans.push_back({i + 1, j + 1});
            reverse(s.begin() + i, s.begin() + j + 1);
            break;
          }
        }
      }
    } else {
      if (s[i] == ')') {
        cnt++;
        continue;
      } else {
        for (long long j = i + 1; j < n; j++) {
          if (s[j] == ')') {
            ans.push_back({i + 1, j + 1});
            reverse(s.begin() + i, s.begin() + j + 1);
            break;
          }
        }
      }
    }
  }
  for (long long i = 2 * k; i < 2 * k + (n - k) / 2; i++) {
    if (s[i] == ')') {
      for (long long j = i + 1; j < n; j++) {
        if (s[j] == '(') {
          ans.push_back({i + 1, j + 1});
          reverse(s.begin() + i, s.begin() + j + 1);
          break;
        }
      }
    }
  }
  cout << ans.size() << "\n";
  for (auto k : ans) {
    cout << k.first << " " << k.second << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long q = 1;
  cin >> q;
  while (q--) solve();
}
