#include <bits/stdc++.h>
using namespace std;
struct shitClass {};
template <class T>
shitClass& operator<<(shitClass& c1, const T&) {
  return c1;
};
shitClass cerr1;
ostream& operator<<(ostream& os, const vector<long long>& a) {
  for (int i = 0; i < a.size(); i++) os << a[i] << " ";
  return os;
}
ostream& operator<<(ostream& os, const pair<long long, long long>& a) {
  os << a.first << " " << a.second;
  return os;
}
ostream& operator<<(ostream& os, const vector<int>& a) {
  for (int i = 0; i < a.size(); i++) os << a[i] << " ";
  return os;
}
istream& operator>>(istream& is, pair<long long, long long>& a) {
  is >> a.first >> a.second;
  return is;
}
string st;
void rev(long long l, long long r) {
  string temp = "";
  for (int i = l; i <= r; i++) temp += st[i];
  for (int i = l; i <= r; i++) {
    st[i] = temp.back();
    temp.pop_back();
  }
}
long long findOpen(long long l) {
  for (int i = l; i < st.size(); i++)
    if (st[i] == '(') return i;
  cerr1 << "WTF" << '\n';
  return -1;
}
long long findClose(long long l) {
  for (int i = l; i < st.size(); i++)
    if (st[i] == ')') return i;
  cerr1 << "WTF" << '\n';
  return -1;
}
vector<pair<long long, long long> > answ;
void adOpen(long long ind) {
  long long op = findOpen(ind);
  answ.push_back({ind, op});
  rev(ind, op);
}
void adClose(long long ind) {
  long long cl = findClose(ind);
  answ.push_back({ind, cl});
  rev(ind, cl);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  for (int counter = 0; counter < t; counter++) {
    long long n, k;
    cin >> n >> k;
    cin >> st;
    long long ind = 0;
    for (int i = 0; i < k - 1; i++) {
      adOpen(ind);
      ind++;
      adClose(ind);
      ind++;
    }
    adOpen(ind);
    ind++;
    while (ind < n - 1) {
      adOpen(ind);
      ind++;
      adClose(ind);
      ind++;
      cerr1 << st << '\n';
    }
    adClose(ind);
    cout << answ.size() << '\n';
    for (int i = 0; i < answ.size(); i++)
      cout << answ[i].first + 1 << " " << answ[i].second + 1 << '\n';
    answ.clear();
  }
  return 0;
}
