#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 9;
const long long N = 500500;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long T;
  cin >> T;
  while (T--) {
    long long n, k;
    cin >> n >> k;
    string s, t;
    cin >> s;
    vector<pair<long long, long long> > ans;
    for (long long i = 1; i <= k - 1; i++) {
      t += "()";
    }
    for (long long i = 1; i <= (n - (2 * k) + 2) / 2; i++) {
      t += "(";
    }
    for (long long i = 1; i <= (n - (2 * k) + 2) / 2; i++) {
      t += ")";
    }
    for (long long i = 0; i < n; i++) {
      if (s[i] == t[i]) continue;
      for (long long j = i + 1; j < n; j++) {
        if (s[j] == t[i]) {
          ans.push_back({i + 1, j + 1});
          reverse(s.begin() + i, s.begin() + j + 1);
          break;
        }
      }
    }
    cout << ans.size() << '\n';
    for (auto z : ans) {
      cout << z.first << " " << z.second << '\n';
    }
  }
  return 0;
}
