#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int o = 0; o < t; o++) {
    char tmp;
    string inp, ans;
    vector<char> s;
    vector<char> s1;
    int n, k, left = 0, right = 0, m = 0, end;
    cin >> n >> k;
    cin >> inp;
    for (int i = 0; i < inp.size(); i++) {
      s.push_back(inp[i]);
      if (inp[i] == '(')
        left++;
      else
        right++;
    }
    for (int i = 0; i < k - 1; i++) {
      s1.push_back('(');
      s1.push_back(')');
      left--;
      right--;
    }
    for (int i = 0; i < left; i++) {
      s1.push_back('(');
    }
    for (int i = 0; i < right; i++) {
      s1.push_back(')');
    }
    for (int i = 0; i < s1.size(); i++) {
      if (s[i] != s1[i]) {
        for (int j = i; j < s.size(); j++) {
          if (s[j] == s1[i]) {
            ans += to_string(i + 1) + ' ' + to_string(j + 1) + "\n";
            m++;
            end = j;
            break;
          }
        }
        for (int j = end; j > i; j--) {
          tmp = s[j];
          s[j] = s[j - 1];
          s[j - 1] = tmp;
        }
      }
    }
    cout << m << endl;
    if (m > 0) {
      ans.erase(ans.size() - 1);
      cout << ans << endl;
    }
  }
}
