#include <bits/stdc++.h>
using ll = long long;
using namespace std;
void per(int l, int r, string &s) {
  for (int i = 0; i <= (r - l) / 2; i++) {
    swap(s[l + i], s[r - i]);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 0;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<pair<int, int> > ans;
    for (int i = 0; i < (k - 1) * 2; i++) {
      int j = i;
      for (; j < n; j++) {
        if (s[j] == '(' && i % 2 == 0 || s[j] == ')' && i % 2 == 1) break;
      }
      ans.push_back({i, j});
      per(i, j, s);
    }
    for (int i = (k - 1) * 2; i < (k - 1) * 2 + (n - (k - 1) * 2) / 2; i++) {
      int j = i;
      for (; j < n; j++) {
        if (s[j] == '(') break;
      }
      ans.push_back({i, j});
      per(i, j, s);
    }
    cout << ans.size() << "\n";
    for (auto p : ans) cout << p.first + 1 << " " << p.second + 1 << "\n";
  }
  return 0;
}
