#include <bits/stdc++.h>
using namespace std;
using cat = long long;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  int T;
  cin >> T;
  while (T--) {
    int N, K;
    string S;
    cin >> N >> K >> S;
    int cur = 0;
    vector<pair<int, int> > ans;
    while (K > 1) {
      for (int i = cur; i < N; i++)
        if (S[i] == '(') {
          ans.push_back({cur, i});
          reverse(begin(S) + cur, begin(S) + i + 1);
          break;
        }
      cur++;
      for (int i = cur; i < N; i++)
        if (S[i] == ')') {
          ans.push_back({cur, i});
          reverse(begin(S) + cur, begin(S) + i + 1);
          break;
        }
      cur++;
      K--;
    }
    K = (N - cur) / 2;
    while (K) {
      for (int i = cur; i < N; i++)
        if (S[i] == '(') {
          ans.push_back({cur, i});
          reverse(begin(S) + cur, begin(S) + i + 1);
          break;
        }
      cur++;
      K--;
    }
    cout << ans.size() << "\n";
    for (auto p : ans) cout << p.first + 1 << " " << p.second + 1 << "\n";
  }
  return 0;
}
