#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e17 + 17;
const long long N = 3e5 + 17;
long long mod = 1e9 + 7;
void precalc() {}
void rev(string& s, long long l, long long r) {
  for (long long left = l, right = r; left < right; ++left, --right) {
    swap(s[left], s[right]);
  }
}
void solve() {
  long long n, k;
  cin >> n >> k;
  long long tk = k - 1;
  string s;
  cin >> s;
  vector<pair<long long, long long> > ans;
  for (long long i = 0; i < n; ++i) {
    if (k > 1) {
      if ((i & 1) == 0 && s[i] == ')') {
        long long j;
        for (j = i + 1; j < n && s[j] != '('; ++j)
          ;
        rev(s, i, j);
        ans.push_back({i, j});
      }
      if ((i & 1) && s[i] == '(') {
        long long j;
        for (j = i + 1; j < n && s[j] != ')'; ++j)
          ;
        rev(s, i, j);
        ans.push_back({i, j});
      }
      k -= i & 1;
    } else {
      if (2 * (i - 2 * tk) < n - 2 * tk && s[i] == ')') {
        long long j;
        for (j = i + 1; j < n && s[j] != '('; ++j)
          ;
        rev(s, i, j);
        ans.push_back({i, j});
      }
      if (2 * (i - 2 * tk) >= n - 2 * tk && s[i] == '(') {
        long long j;
        for (j = i + 1; j < n && s[j] != ')'; ++j)
          ;
        rev(s, i, j);
        ans.push_back({i, j});
      }
    }
  }
  cout << ans.size() << '\n';
  for (auto& a : ans) cout << a.first + 1 << ' ' << a.second + 1 << '\n';
}
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << setprecision(10) << fixed;
  precalc();
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
