#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long t;
  cin >> t;
  for (long long wer = 0; wer < t; wer++) {
    long long n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    string t = "";
    for (long long i = 0; i < (n / 2 - k + 1); i++) {
      t += '(';
    }
    for (long long i = 0; i < (n / 2 - k + 1); i++) {
      t += ")";
    }
    for (long long i = 0; i < (k - 1); i++) {
      t += "()";
    }
    vector<char> st;
    for (long long i = 0; i < n; i++) {
      st.push_back(s[i]);
    }
    vector<pair<long long, long long>> ans;
    for (long long i = 0; i < n; i++) {
      if (st[i] != t[i]) {
        long long r = 0;
        for (long long j = i + 1; j < n; j++) {
          if (st[j] == t[i]) {
            r = j;
          }
        }
        vector<char> st1(n);
        for (long long qr = 0; qr < n; qr++) {
          st1[qr] = st[qr];
        }
        for (long long j = i; j <= r; j++) {
          st1[j] = st[r + i - j];
        }
        st = st1;
        ans.push_back({i + 1, r + 1});
      }
    }
    cout << ans.size() << "\n";
    for (long long i = 0; i < ans.size(); i++) {
      cout << ans[i].first << " " << ans[i].second << "\n";
    }
  }
  return 0;
}
