#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(vector<T> &a, long long n) {
  T x;
  a.clear();
  for (long long i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
  }
}
template <class T>
void write(vector<T> &a) {
  for (T x : a) cout << x << " ";
  cout << endl;
}
string x;
int n, k;
void rev(int l, int r) {
  while (r > l) {
    swap(x[l], x[r]);
    l++;
    r--;
  }
}
int fnd(int pos, char c) {
  for (int i = pos; i < n; i++)
    if (x[i] == c) return i;
  return -1;
}
int main() {
  ios_base::sync_with_stdio(0);
  int T;
  cin >> T;
  while (T--) {
    cin >> n >> k >> x;
    string need = "";
    for (int i = 0; i < k - 1; i++) {
      need += '(';
      need += ')';
    }
    int extermination = n - (int)need.size();
    for (int i = 0; i < extermination / 2; i++) need += '(';
    for (int i = 0; i < extermination / 2; i++) need += ')';
    vector<pair<int, int> > ans;
    for (int i = 0; i < n; i++) {
      if (need[i] != x[i]) {
        int pos = fnd(i, need[i]);
        ans.push_back(make_pair(i, pos));
        rev(i, pos);
      }
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++)
      cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
  }
}
