#include <bits/stdc++.h>
using namespace std;
string s;
int N, K, T;
vector<pair<int, int> > ret;
void rev(int x, int y) {
  if (x > y) swap(x, y);
  ret.push_back(make_pair(x, y));
  while (x < y) {
    swap(s[x], s[y]);
    ++x;
    --y;
  }
}
void make(int pos, char c) {
  if (s[pos] == c) return;
  for (int i = pos; i < (int)(s).size(); ++i) {
    if (s[i] == c) {
      rev(pos, i);
      break;
    }
  }
}
int main() {
  cin.sync_with_stdio(0);
  cin >> T;
  while (T--) {
    cin >> N >> K;
    cin >> s;
    ret.clear();
    int st = 0;
    int dr = (int)(s).size() - 1;
    while (st <= dr) {
      if (K == 1) {
        make(st, '(');
        make(dr, ')');
        ++st;
        --dr;
      } else {
        make(st, '(');
        make(st + 1, ')');
        st += 2;
      }
      --K;
    }
    cout << (int)(ret).size() << endl;
    for (int i = 0; i < ((int)(ret).size()); ++i)
      cout << ret[i].first + 1 << " " << ret[i].second + 1 << "\n";
  }
  return 0;
}
