#include <bits/stdc++.h>
using namespace std;
void bst() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
}
char arr[3000];
int n, k;
void rev(int l, int r) {
  int b[3000];
  for (int i = l; i <= r; i++) b[i] = arr[i];
  for (int i = l; i <= r; i++) arr[i] = b[r - i + l];
}
int main() {
  bst();
  int q;
  cin >> q;
  for (int f = 1; f <= q; f++) {
    cin >> n >> k;
    char t;
    for (int i = 1; i <= n; i++) {
      cin >> arr[i];
    }
    pair<int, int> ans[3000];
    for (int i = 1; i <= n; i++) ans[i] = make_pair(0, 0);
    int nz = 1;
    for (int i = 1; i <= 2 * (k - 1); i++) {
      if (i == 1) {
        if (arr[i] == ')')
          for (int j = n; j >= i + 1; j--) {
            if (arr[j] == '(') {
              ans[nz] = make_pair(i, j);
              nz++;
              rev(i, j);
              break;
            }
          }
        continue;
      }
      if (arr[i] == '(') {
        if (arr[i - 1] == '(') {
          for (int j = n; j >= i + 1; j--) {
            if (arr[j] == ')') {
              ans[nz] = make_pair(i, j);
              nz++;
              rev(i, j);
              break;
            }
          }
        }
      } else {
        if (arr[i - 1] == ')') {
          for (int j = n; j >= i + 1; j--) {
            if (arr[j] == '(') {
              ans[nz] = make_pair(i, j);
              nz++;
              rev(i, j);
              break;
            }
          }
        }
      }
    }
    int cnt = k - 1;
    for (int i = 2 * (k - 1) + 1; i <= n; i++) {
      if (cnt == n / 2) {
        break;
      }
      if (arr[i] == ')') {
        for (int j = n; j >= i + 1; j--) {
          if (arr[j] == '(') {
            ans[nz] = make_pair(i, j);
            nz++;
            rev(i, j);
            break;
          }
        }
      }
      cnt++;
    }
    cnt = k - 1;
    for (int i = 2 * (k - 1) + 2 + n / 2 - (k - 1); i <= n; i++) {
      if (cnt == n / 2) break;
      if (arr[i] == '(') {
        for (int j = n; j >= i + 1; j--) {
          if (arr[j] == ')') {
            ans[nz] = make_pair(i, j);
            nz++;
            rev(i, j);
            break;
          }
        }
      }
    }
    nz--;
    cout << nz << endl;
    for (int i = 1; i <= nz; i++) {
      int f = ans[i].first;
      int s = ans[i].second;
      cout << f << " " << s << endl;
    }
  }
  return 0;
}
