#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
void solve() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<pair<int, int>> res;
  string s2;
  int n2 = n - 2 * (k - 1);
  for (int i = 0; i < 2 * (k - 1); ++i) {
    if (i % 2) {
      s2.push_back(')');
    } else {
      s2.push_back('(');
    }
  }
  for (int i = 0; i < n2; ++i) {
    if (i < n2 / 2) {
      s2.push_back('(');
    } else {
      s2.push_back(')');
    }
  }
  for (int i = 0; i < n; ++i) {
    if (s[i] != s2[i]) {
      for (int j = i + 1; j < n; ++j) {
        if (s[j] == s2[i]) {
          reverse(s.begin() + i, s.begin() + j + 1);
          res.push_back({i, j});
          break;
        }
      }
    }
  }
  cout << res.size() << "\n";
  for (const auto &p : res) {
    cout << p.first + 1 << " " << p.second + 1 << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
