#include <bits/stdc++.h>
using namespace std;
void swap(string &s, int l, int r) {
  for (int i = l; i <= r; i++) {
    int v = (r + l - i);
    if (v <= i) break;
    char temp = s[i];
    s[i] = s[v];
    s[v] = temp;
  }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int test;
  cin >> test;
  while (test--) {
    vector<pair<int, int> > res;
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    string t;
    for (int i = 1; i < k; i++) {
      t += "()";
    }
    string temp;
    for (int i = 1; i <= (n / 2 - k + 1); i++) {
      temp += "(";
    }
    for (int i = 1; i <= (n / 2 - k + 1); i++) {
      temp += ")";
    }
    t += temp;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] != t[i]) {
        int u;
        for (int j = i + 1; j < n; j++) {
          if (s[j] == t[i]) {
            u = j;
            break;
          }
        }
        res.push_back({i, u});
        swap(s, i, u);
      }
    }
    cout << res.size() << '\n';
    for (auto u : res) cout << u.first + 1 << ' ' << u.second + 1 << '\n';
  }
  return 0;
}
