#include <bits/stdc++.h>
using namespace std;
int findFirstOpen(string &s1, int start, int end) {
  for (int i = start; i < end; i++) {
    if (s1[i] == '(') return i;
  }
  return -1;
}
int findFirstClosed(string &s1, int start, int end) {
  for (int i = start; i < end; i++) {
    if (s1[i] == ')') return i;
  }
  return -1;
}
void operate(string &s1, int start, int end) {
  for (int i = 0; i <= (end - start) / 2; i++) {
    swap(s1[start + i], s1[end - i]);
  }
  return;
}
void makePrefix(vector<pair<int, int>> &res, string &s1, int start, int end,
                int n) {
  for (int i = start; i < end; i = i + 2) {
    if (s1[i] == ')') {
      int x = findFirstOpen(s1, i + 1, n);
      operate(s1, i, x);
      res.push_back(make_pair(i + 1, x + 1));
    }
    if (s1[i + 1] == '(') {
      int x = findFirstClosed(s1, i + 1, n);
      operate(s1, i + 1, x);
      res.push_back(make_pair(i + 2, x + 1));
    }
  }
  return;
}
void solve(vector<pair<int, int>> &res, string s1, int n, int k) {
  makePrefix(res, s1, 0, 2 * k - 2, n);
  int i = 2 * k - 2;
  if (s1[i] == ')') {
    int x = findFirstOpen(s1, i + 1, n);
    res.push_back(make_pair(i + 1, x + 1));
    operate(s1, i, x);
  }
  if (s1[n - 1] == '(') {
    int x = findFirstClosed(s1, i + 1, n);
    res.push_back(make_pair(x + 1, n));
    operate(s1, x, n - 1);
  }
  makePrefix(res, s1, 2 * k - 1, n - 1, n);
  return;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s1;
    cin >> s1;
    vector<pair<int, int>> v;
    solve(v, s1, n, k);
    cout << v.size() << endl;
    for (int i = 0; i < v.size(); i++) {
      cout << v[i].first << " " << v[i].second << endl;
    }
  }
}
