#include <bits/stdc++.h>
#pragma GCC_OPTIMIZE("ofast")
using namespace std;
void solve() {
  long long n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  string need;
  for (long long i = 0; i < k - 1; i++) {
    need.push_back('(');
    need.push_back(')');
  }
  for (long long i = 0; i < n / 2 - (k - 1); i++) {
    need.push_back('(');
  }
  for (long long i = 0; i < n / 2 - (k - 1); i++) {
    need.push_back(')');
  }
  vector<pair<long long, long long>> ans;
  for (long long i = 0; i < n; i++) {
    if (s[i] != need[i]) {
      for (long long j = i + 1; j < n; j++) {
        if (s[j] == need[i]) {
          ans.push_back(make_pair(i + 1, j + 1));
          reverse(s.begin() + i, s.begin() + j + 1);
          break;
        }
      }
    }
  }
  cout << ans.size() << "\n";
  for (long long i = 0; i < ans.size(); i++) {
    cout << ans[i].first << " " << ans[i].second << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long q;
  cin >> q;
  for (long long i = 0; i < q; i++) {
    solve();
  }
}
