#include <bits/stdc++.h>
using namespace std;
int t, n, k;
char s[4000];
int opx[4000];
int opy[4000];
int count2;
void Reverse(char *s, int a, int b) {
  for (int i = a, j = b; i < j; i++, j--) {
    char c = s[i];
    s[i] = s[j];
    s[j] = c;
  }
}
int main() {
  cin >> t;
  while (t--) {
    cin >> n >> k;
    cin >> s;
    int count1 = 0;
    while (count1 < 2 * k - 3) {
      if (s[count1] == '(') {
        for (int i = count1 + 1; i < n; i++) {
          if (s[i] == ')') {
            count2++;
            opx[count2] = count1 + 2;
            opy[count2] = i + 1;
            Reverse(s, count1 + 1, i);
            break;
          }
        }
      } else {
        for (int i = count1 + 1; i < n; i++) {
          if (s[i] == '(') {
            count2++;
            opx[count2] = count1 + 1;
            opy[count2] = i + 1;
            Reverse(s, count1, i);
            break;
          }
        }
      }
      count1 += 2;
    }
    while (count1 < n && s[count1] == '(') count1++;
    while (count1 < n) {
      int count3 = count1;
      while (count3 < n && s[count3] == ')') count3++;
      if (count3 < n) {
        count2++;
        opx[count2] = count1 + 1;
        opy[count2] = count3 + 1;
        Reverse(s, count1, count3);
        count1++;
      } else {
        break;
      }
    }
    cout << count2 << endl;
    for (int i = 1; i <= count2; i++) {
      cout << opx[i] << ' ' << opy[i] << endl;
    }
    count2 = 0;
  }
}
