#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 7;
char s[N];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n, K;
    scanf("%d%d", &n, &K);
    scanf("%s", s);
    int j = 0;
    vector<pair<int, int>> ans;
    for (int i = 0; i < 2 * (K - 1); i++) {
      if (i & 1) {
        int k = i;
        j = k;
        while (k < n && s[k] != ')') k++;
        reverse(s + j, s + k + 1);
        ans.push_back({j, k});
      } else {
        int k = i;
        j = k;
        while (k < n && s[k] != '(') k++;
        reverse(s + j, s + k + 1);
        ans.push_back({j, k});
      }
    }
    int num = n - 2 * (K - 1);
    for (int i = 0; i < num; i++) {
      if (i < num / 2) {
        int k = i + 2 * (K - 1);
        j = k;
        while (k < n && s[k] != '(') k++;
        reverse(s + j, s + k + 1);
        ans.push_back({j, k});
      } else {
        int k = i + 2 * (K - 1);
        j = k;
        while (k < n && s[k] != ')') k++;
        reverse(s + j, s + k + 1);
        ans.push_back({j, k});
      }
    }
    printf("%d\n", ans.size());
    for (auto v : ans) printf("%d %d\n", v.first + 1, v.second + 1);
  }
  return 0;
}
