#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<pair<int, int> > v;
    string a(""), b(""), c(""), s;
    cin >> s;
    for (int i = int(1); i <= int(k - 1); i++) a += "()";
    for (int i = int(1); i <= int(n / 2 - (k - 1)); i++) b += '(', c += ')';
    a += b, a += c;
    for (int i = int(0); i <= int(n - 1); i++) {
      if (s[i] == a[i]) continue;
      for (int j = int(i + 1); j <= int(n - 1); j++) {
        if (s[j] == a[i]) {
          v.push_back({i + 1, j + 1});
          reverse(s.begin() + i, s.begin() + j + 1);
          break;
        }
      }
    }
    cout << v.size() << "\n";
    for (auto it : v) cout << it.first << " " << it.second << "\n";
  }
}
