#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INFLL = 1e12;
const int MOD = 1000000007;
const long double eps = 1e-7;
const int MOD2 = (1 << 30) + 1;
void fast_io() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
string change(string s, int i, int ans) {
  string kek = s;
  string answer = s.substr(i, i + (ans - i) + 1);
  for (int j = ans; j >= i; j--) {
    kek[j] = answer[ans - j];
  }
  return kek;
}
signed main() {
  fast_io();
  int t;
  cin >> t;
  string kek = "()((";
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    string answer = "";
    for (int i = 0; i < 2 * k - 2; i++) {
      if (i & 1) {
        answer += "(";
      } else {
        answer += ")";
      }
    }
    for (int i = 2 * k - 2; i < 2 * k - 2 + (n - 2 * k + 2) / 2; i++) {
      answer += ")";
    }
    for (int i = 2 * k - 2 + (n - 2 * k + 2) / 2; i < n; i++) {
      answer += "(";
    }
    reverse(answer.begin(), answer.end());
    vector<pair<int, int>> ans2;
    for (int i = 0; i < n; i++) {
      if (s[i] != answer[i]) {
        int ans = i;
        for (int j = i + 1; j < n; j++) {
          if (s[j] == answer[i]) {
            ans = j;
            break;
          }
        }
        ans2.push_back(make_pair(i + 1, ans + 1));
        s = change(s, i, ans);
      }
    }
    cout << ans2.size() << endl;
    for (pair<int, int> i : ans2) {
      cout << i.first << " " << i.second << endl;
    }
  }
  return 0;
}
