#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long power(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    string str;
    string temp = "";
    std::vector<pair<long long, long long> > ans;
    cin >> n >> k >> str;
    long long cnt = n / 2;
    long long req = cnt - k;
    for (long long i = 0; i < req + 1; i++) {
      temp += '(';
    }
    for (long long i = req + 1; i <= 2 * req + 1; i++) {
      temp += ')';
    }
    for (long long i = 2 * req + 2; i < n; i += 2) {
      temp += '(';
      temp += ')';
    }
    for (long long i = 0; i < n; i++) {
      if (str[i] == temp[i]) continue;
      if (temp[i] == '(') {
        for (long long j = i + 1; j <= n - 1; j++) {
          if (str[j] == '(') {
            ans.push_back({i + 1, j + 1});
            long long l = i, r = j;
            while (l < r) {
              swap(str[l], str[r]);
              l++;
              r--;
            }
            break;
          }
        }
      } else {
        for (long long j = i + 1; j <= n - 1; j++) {
          if (str[j] == ')') {
            ans.push_back({i + 1, j + 1});
            long long l = i, r = j;
            while (l < r) {
              swap(str[l], str[r]);
              l++;
              r--;
            }
            break;
          }
        }
      }
    }
    cout << ans.size() << endl;
    for (auto& i : ans) {
      cout << i.first << " " << i.second << endl;
    }
  }
  return 0;
}
