#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2200;
char s[MAXN], t[MAXN];
int l[MAXN], r[MAXN];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n, k, m = 0;
    scanf("%d%d%s", &n, &k, s + 1);
    for (int i = 1; i < k; i++) t[2 * i - 1] = '(', t[2 * i] = ')';
    for (int i = 2 * k - 1; i < k + n / 2; i++) t[i] = '(';
    for (int i = k + n / 2; i <= n; i++) t[i] = ')';
    for (int i = 1; i <= n; i++)
      if (s[i] != t[i]) {
        int k;
        for (int j = i + 1; j <= n; j++)
          if (s[j] == t[i]) {
            k = j;
            break;
          }
        l[++m] = i;
        r[m] = k;
        reverse(s + i, s + k + 1);
      }
    printf("%d\n", m);
    for (int i = 1; i <= m; i++) printf("%d %d\n", l[i], r[i]);
  }
  return 0;
}
