#include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 5;
int n;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    string s, p;
    cin >> n >> k;
    cin >> s;
    for (int i = 1; i < k; i++) {
      p += "()";
    }
    int rest = n / 2 - k + 1;
    for (int i = 1; i <= rest; i++) {
      p += '(';
    }
    for (int i = 1; i <= rest; i++) {
      p += ')';
    }
    vector<pair<int, int> > ans;
    for (int i = 0; i < s.size(); i++) {
      if (s[i] == p[i]) {
        continue;
      }
      int pos = i;
      while (pos < s.size() && s[pos] != p[i]) {
        pos++;
      }
      assert(pos < s.size());
      ans.push_back(make_pair(i, pos));
      reverse(s.begin() + i, s.begin() + pos + 1);
    }
    cout << ans.size() << endl;
    for (pair<int, int> p : ans) {
      cout << p.first + 1 << " " << p.second + 1 << endl;
    }
  }
}
