#include <bits/stdc++.h>
using namespace std;
int main() {
  int T, N, K;
  string original, target;
  vector<pair<int, int> > answer;
  cin >> T;
  for (int cases = 1; cases <= T; cases++) {
    cin >> N >> K;
    cin >> original;
    target = "";
    for (int i = 1; i < K; i++) target += "()";
    for (int i = 1; i <= (N - 2 * (K - 1)) / 2; i++) target += "(";
    for (int i = 1; i <= (N - 2 * (K - 1)) / 2; i++) target += ")";
    answer.clear();
    for (int i = 0; i < original.size(); i++) {
      if (original[i] == target[i]) continue;
      int leftIndex = i;
      int rightIndex;
      for (int j = i; j < target.size(); j++) {
        if (original[j] == target[i]) {
          rightIndex = j;
          break;
        }
      }
      answer.push_back(make_pair(leftIndex, rightIndex));
      while (leftIndex < rightIndex) {
        char temp = original[leftIndex];
        original[leftIndex] = original[rightIndex];
        original[rightIndex] = temp;
        leftIndex += 1;
        rightIndex -= 1;
      }
    }
    cout << answer.size() << endl;
    for (int i = 0; i < answer.size(); i++)
      cout << answer[i].first + 1 << " " << answer[i].second + 1 << endl;
  }
}
