#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const long long LINF = 1e18 + 7;
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<pair<int, int> > ans;
  bool f = 1;
  for (int i = 0; i < n - (k - 1) * 2; i++) {
    if (i < (n - (k - 1) * 2) / 2 && s[i] == ')') {
      int j = i + 1;
      while (j < n && s[j] != '(') j++;
      if (j == n) {
        f = 0;
        break;
      }
      ans.push_back(make_pair(i + 1, j + 1));
      reverse(s.begin() + i, s.begin() + j + 1);
    }
    if (i >= (n - (k - 1) * 2) / 2 && s[i] == '(') {
      int j = i + 1;
      while (j < n && s[j] != ')') j++;
      if (j == n) {
        f = 0;
        break;
      }
      ans.push_back(make_pair(i + 1, j + 1));
      reverse(s.begin() + i, s.begin() + j + 1);
    }
  }
  for (int i = n - (k - 1) * 2; i < n; i++) {
    if (i % 2 == 0 && s[i] == ')') {
      int j = i + 1;
      while (j < n && s[j] != '(') j++;
      if (j == n) {
        f = 0;
        break;
      }
      ans.push_back(make_pair(i + 1, j + 1));
      reverse(s.begin() + i, s.begin() + j + 1);
    }
    if (i % 2 == 1 && s[i] == '(') {
      int j = i + 1;
      while (j < n && s[j] != ')') j++;
      if (j == n) {
        f = 0;
        break;
      }
      ans.push_back(make_pair(i + 1, j + 1));
      reverse(s.begin() + i, s.begin() + j + 1);
    }
  }
  cout << ans.size() << '\n';
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].first << ' ' << ans[i].second << '\n';
  }
}
int main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios::sync_with_stdio(false);
  int tests;
  cin >> tests;
  for (int i = 0; i < tests; i++) {
    solve();
  }
  return 0;
}
