#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
void normalize(string& s, vector<pii>& ans) {
  const int n = s.size();
  for (int i = 0; i < n / 2; ++i) {
    if (s[i] == '(') continue;
    for (int j = i + 1; j < n; ++j) {
      if (s[j] == '(') {
        ans.emplace_back(i + 1, j + 1);
        reverse(s.begin() + i, s.begin() + j + 1);
        break;
      }
    }
  }
}
void solve(string& s, int k, vector<pii>& ans) {
  const int n = s.size();
  for (int i = 1, it = 0; it < k - 1; i += 2, ++it) {
    ans.emplace_back(i + 1, i + (n - it * 2) / 2);
  }
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<pii> ans;
    normalize(s, ans);
    solve(s, k, ans);
    cout << ans.size() << "\n";
    for (auto const& [l, r] : ans) {
      cout << l << " " << r << "\n";
    }
  }
}
