#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  for (int i = 0; i < k; i++) {
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    cout << N << endl;
    vector<int> v;
    for (int i = 0; i < N; i++) {
      if (S[i] == '(') {
        v.push_back(i);
      }
    }
    for (int i = 0; i < N; i++) {
    }
    for (int i = 0; i < N / 2; i++) {
      cout << (i + 1) << " " << (v[i] + 1) << endl;
    }
    vector<int> cor;
    for (int i = 0; i < K - 1; i++) {
      cor.push_back(i * 2 + 1);
    }
    for (int i = 2 * (K - 1) + (N - 2 * (K - 1)) / 2; i < N; i++) {
      cor.push_back(i);
    }
    for (int i = 0; i < N / 2; i++) {
      cout << cor[i] + 1 << " " << i + N / 2 + 1 << endl;
    }
  }
}
