#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    k--;
    string s;
    cin >> s;
    string ans = "";
    for (long long i = 0; i < k; i++) ans += "()";
    ans += '(';
    long long n1 = n - (2 * k);
    n1--;
    for (long long i = 0; i < n1 / 2; i++) ans += "()";
    ans += ')';
    vector<pair<long long, long long> > ans1;
    for (long long i = 0; i < n; i++) {
      if (s[i] == ans[i]) continue;
      long long temp1 = i;
      long long temp2 = i;
      for (long long j = i; j < n; j++) {
        if (s[j] == ans[i]) {
          temp1 = i;
          temp2 = j;
          ans1.push_back(make_pair(i, j));
          break;
        }
      }
      long long len = temp2 - temp1 + 1;
      string have = s.substr(temp1, len);
      reverse(have.begin(), have.end());
      for (long long j = temp1; j <= temp2; j++) s[j] = have[j - temp1];
      reverse(have.begin(), have.end());
    }
    cout << ans1.size() << endl;
    for (long long i = 0; i < ans1.size(); i++)
      cout << ans1[i].first + 1 << " " << ans1[i].second + 1 << endl;
  }
}
