#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6 + 1;
const int INF = 2e9 + 1;
const int MOD = (1e9 + 7);
void bye(string s = "") {
  cout << s << '\n';
  exit(0);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int cur = 0;
    int kek = 0;
    vector<pair<int, int> > ans;
    string obr = "";
    for (int i = 0; i < k - 1; i++) {
      obr.push_back('(');
      obr.push_back(')');
    }
    int p = int((s).size()) - int((obr).size());
    p /= 2;
    for (int i = 0; i < p; i++) {
      obr.push_back('(');
    }
    for (int i = 0; i < p; i++) {
      obr.push_back(')');
    }
    for (int i = 0; i < n; i++) {
      if (obr[i] == s[i]) continue;
      for (int j = i; j < n; j++) {
        if (s[j] == obr[i]) {
          ans.emplace_back(i, j);
          reverse(s.begin() + i, s.begin() + j + 1);
          break;
        }
      }
    }
    cout << int((ans).size()) << '\n';
    for (auto &x : ans) {
      cout << x.first + 1 << ' ' << x.second + 1 << '\n';
    }
  }
  bye();
}
