#include <bits/stdc++.h>
using namespace std;
long long exp(long long taban, long long us) {
  long long carpan = taban % 1000000007;
  long long temp = us;
  long long res = 1;
  while (temp) {
    if (temp % 2) res = (res * carpan) % 1000000007;
    temp /= 2;
    carpan = (carpan * carpan) % 1000000007;
  }
  return res;
}
long long ebob(long long a, long long b) {
  if (!a) return b;
  return ebob(b % a, a);
}
long long ekok(long long a, long long b) { return (a * b) / ebob(a, b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    bool c = 0;
    string tmp = "()";
    vector<pair<int, int> > res;
    int until = -1;
    for (int i = 0; i < n; i++) {
      if (k == 1 && i % 2 == 0) {
        until = (i + n - 1) / 2;
        k--;
      }
      int last = i;
      for (int j = i; j < n; j++) {
        if (s[j] == tmp[c]) {
          last = j;
          break;
        }
      }
      if (until == -1) c ^= 1;
      if (i == until) c ^= 1;
      if (i % 2) k--;
      for (int u = i; u <= (i + last) / 2; u++) {
        swap(s[u], s[i + last - u]);
      }
      res.push_back({i + 1, last + 1});
    }
    cout << res.size() << "\n";
    for (auto &x : res) cout << x.first << " " << x.second << "\n";
  }
}
