#include <bits/stdc++.h>
using namespace std;
ifstream fin("AAtest.in.txt");
string s, s1;
long long t, n, k, mit, pal, l;
vector<pair<long long, long long> > p;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  cin >> t;
  while (t--) {
    cin >> n >> k;
    cin >> s;
    s1 = "";
    for (int i = 0; i < k - 1; i++) s1 += "()";
    for (int i = 0; i < n / 2 - (k - 1); i++) s1 += "(";
    for (int i = 0; i < n / 2 - (k - 1); i++) s1 += ")";
    p.resize(0);
    for (int i = n - 1; i >= 0; i--)
      if (s[i] != s1[i]) {
        l = i;
        while (s[l] != s1[i]) l--;
        p.push_back({l + 1, i + 1});
        swap(s[i], s[l]);
      }
    cout << p.size() << "\n";
    for (int i = 0; i < p.size(); i++)
      cout << p[i].first << " " << p[i].second << "\n";
  }
}
