#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    string s;
    cin >> n >> k >> s;
    vector<long long> l, r;
    char so;
    for (long long i = 0; i < (long long)n; i++) {
      so = '(';
      if (k > 1 && i % 2) {
        so = ')';
        k--;
      }
      if (s[i] == so) continue;
      string::iterator fi = find(s.begin() + i, s.end(), so);
      if (fi == s.end()) break;
      l.push_back(i + 1);
      r.push_back(fi - s.begin() + 1);
      reverse(s.begin() + i, fi + 1);
    }
    cout << l.size();
    cout << "\n";
    for (long long i = 0; i < (long long)l.size(); i++) {
      cout << l[i] << ' ' << r[i];
      cout << "\n";
    }
    cout << "\n";
  }
  return 0;
}
