#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int cases;
  cin >> cases;
  for (int cs = 0; cs < cases; cs++) {
    int n, k;
    cin >> n >> k;
    string a;
    cin >> a;
    string st = "";
    for (int i = 0; i < k - 1; i++) {
      st += "()";
    }
    for (int i = 0; i < (n - (k - 1) * 2) / 2; i++) {
      st += "(";
    }
    for (int i = 0; i < (n - (k - 1) * 2) / 2; i++) {
      st += ")";
    }
    vector<pair<int, int> > ans;
    for (int i = 0; i < n; i++) {
      if (a[i] != st[i]) {
        for (int j = i + 1; j < n; j++) {
          if (a[j] == st[i]) {
            ans.push_back(pair<int, int>(i, j));
            for (int k = i; k <= (i + j) / 2; k++) {
              swap(a[k], a[i + j - k]);
            }
            break;
          }
        }
      }
    }
    cout << ans.size() << '\n';
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i].first + 1 << " " << ans[i].second + 1 << '\n';
    }
  }
}
