#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
const long long int INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int k;
    cin >> k;
    string s;
    cin >> s;
    string t = "";
    for (int i = 0; i < (k - 1); i++) t += "()";
    for (int i = 0; i < (n - (k - 1) * 2) / 2; i++) t += "(";
    for (int i = 0; i < (n - (k - 1) * 2) / 2; i++) t += ")";
    vector<pair<int, int>> ops;
    for (int i = 0; i < n; i++) {
      if (s[i] == t[i]) continue;
      int j = i + 1;
      while (j < n && s[j] != t[i]) {
        j++;
      }
      ops.push_back({i + 1, j + 1});
      reverse(s.begin() + i, s.begin() + j + 1);
    }
    cout << ops.size() << "\n";
    assert(s == t);
    for (auto pp : ops) cout << pp.first << " " << pp.second << "\n";
  }
  return 0;
}
