#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t > 0) {
    int n, k, count = 0;
    cin >> n >> k;
    string s, c;
    vector<int> lab;
    cin >> s;
    for (int i = 0; i < k - 1; i++) {
      c.push_back('(');
      c.push_back(')');
    }
    for (int i = 0; i < (n - 2 * k) / 2 + 1; i++) {
      c.push_back('(');
    }
    for (int i = 0; i < (n - 2 * k) / 2 + 1; i++) {
      c.push_back(')');
    }
    for (int i = 0; i < n; i++) {
      if (c[i] != s[i]) {
        int j = i;
        while (c[i] != s[j]) {
          j++;
        }
        reverse(s.begin() + i, s.begin() + j + 1);
        count++;
        lab.push_back(i + 1);
        lab.push_back(j + 1);
      }
    }
    cout << count << endl;
    for (int i = 0; i < lab.size(); i = i + 2) {
      cout << lab[i] << " " << lab[i + 1] << endl;
    }
    t--;
  }
}
