#include <bits/stdc++.h>
using namespace std;
int n, k;
string s;
vector<pair<int, int> > res;
void Reverse(int l, int r) {
  string cur = s;
  for (int i = l, j = r; i <= r; i++, j--) {
    cur[i] = s[j];
  }
  s = cur;
  res.push_back({l, r});
}
void find(int i, char c) {
  if (s[i] == c) return;
  for (int j = i + 1; j < n; j++)
    if (s[j] == c) {
      Reverse(i, j);
      break;
    }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> k >> s;
    int j = 0;
    for (int i = 0; i < k - 1; i++, j += 2) {
      find(j, '(');
      find(j + 1, ')');
    }
    int ne = n - j + 1;
    for (int i = 0; i < ne / 2; i++, j++) {
      find(j, '(');
    }
    for (int i = 0; i < ne / 2; i++, j++) {
      find(j, ')');
    }
    cout << res.size() << endl;
    for (pair<int, int> p : res)
      cout << p.first + 1 << " " << p.second + 1 << endl;
    res.clear();
  }
}
