#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    string str, tar;
    cin >> n >> k;
    cin >> str;
    for (long long i = 1; i < k; i++) {
      tar += "(";
      tar += ")";
    }
    long long xx = n - tar.size();
    for (long long i = 1; i <= xx / 2; i++) {
      tar += "(";
    }
    for (long long i = 1; i <= xx / 2; i++) {
      tar += ")";
    }
    vector<pair<long long, long long>> v;
    for (long long i = 0; i < n; i++) {
      if (tar[i] != str[i]) {
        long long a, b;
        a = i;
        for (long long j = i; j < n; j++) {
          if (str[j] == tar[i]) {
            b = j;
            break;
          }
        }
        for (long long i = a; i <= a - 1 + (b - a + 1) / 2; i++) {
          char t = str[i];
          str[i] = str[b + a - i];
          str[b + a - i] = t;
        }
        a++;
        b++;
        v.push_back(make_pair(a, b));
      }
    }
    cout << v.size() << '\n';
    for (long long i = 0; i < v.size(); i++) {
      cout << v[i].first << " " << v[i].second << '\n';
    }
  }
  return 0;
}
