#include <bits/stdc++.h>
using namespace std;
const double pai = acos(-1);
const double eps = 1e-8;
const long long mod = 1e9 + 7;
const int MXN = 1e6 + 5;
char s[MXN];
char t[MXN];
int MAIN(int avg) {
  int n, k;
  cin >> n >> k;
  k--;
  cin >> s;
  vector<pair<int, int> > ans;
  for (int i = 0; i < k * 2; i++) {
    if (i % 2 == 0) {
      if (s[i] == '(') continue;
      int j = i + 1;
      for (; j < n; j++)
        if (s[j] == '(') break;
      for (int z = i; z <= j; z++) t[z] = s[z];
      for (int z = i; z <= j; z++) s[z] = t[j - (z - i)];
      ans.push_back(make_pair(i, j));
    }
    if (i % 2 == 1) {
      if (s[i] == ')') continue;
      int j = i + 1;
      for (; j < n; j++)
        if (s[j] == ')') break;
      for (int z = i; z <= j; z++) t[z] = s[z];
      for (int z = i; z <= j; z++) s[z] = t[j - (z - i)];
      ans.push_back(make_pair(i, j));
    }
  }
  for (int i = k * 2; i < k * 2 + (n - k * 2) / 2; i++) {
    if (s[i] == '(') continue;
    int j = i + 1;
    for (; j < n; j++)
      if (s[j] == '(') break;
    for (int z = i; z <= j; z++) t[z] = s[z];
    for (int z = i; z <= j; z++) s[z] = t[j - (z - i)];
    ans.push_back(make_pair(i, j));
  }
  for (int i = k * 2 + (n - k * 2) / 2; i < n; i++) {
    if (s[i] == ')') continue;
    int j = i + 1;
    for (; j < n; j++)
      if (s[j] == ')') break;
    for (int z = i; z <= j; z++) t[z] = s[z];
    for (int z = i; z <= j; z++) s[z] = t[j - (z - i)];
    ans.push_back(make_pair(i, j));
  }
  cout << (int)ans.size() << '\n';
  for (auto i : ans) cout << i.first + 1 << ' ' << i.second + 1 << '\n';
  return 0;
}
int main() {
  int ca;
  cin >> ca;
  for (int i = 1; i <= ca; i++) MAIN(i);
  return 0;
}
