#include <bits/stdc++.h>
using namespace std;
signed main() {
  int t;
  cin >> t;
  for (int q = 0; q < t; q++) {
    int n, k;
    cin >> n >> k;
    vector<pair<int, int>> ans;
    vector<char> s;
    for (int i = 0; i < n; i++) {
      char x;
      cin >> x;
      s.push_back(x);
    }
    int cur = 0;
    k--;
    for (int i = 0; i < n - 1; i++) {
      if (s[i] == '(') {
        cur++;
      } else
        cur--;
      if (cur == 0 && k != 0) {
        k--;
        continue;
      }
      if ((cur == 0 && k == 0) || (cur < 0)) {
        cur += 2;
        int ind = i;
        for (int j = i + 1; j < n; j++) {
          if (s[j] == '(') {
            ind = j;
            break;
          }
        }
        for (int j = i; j < i + (ind - i + 1) / 2; j++) {
          swap(s[j], s[ind - j + i]);
        }
        ans.push_back({i, ind});
      } else if (cur > 1 && k != 0 && s[i] != ')') {
        cur -= 2;
        int ind = i;
        for (int j = i + 1; j < n; j++) {
          if (s[j] == ')') {
            ind = j;
            break;
          }
        }
        for (int j = i; j < i + (ind - i + 1) / 2; j++) {
          swap(s[j], s[ind - j + i]);
        }
        ans.push_back({i, ind});
        if (cur == 0) k--;
      }
    }
    cout << ans.size() << "\n";
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i].first + 1 << " " << ans[i].second + 1 << '\n';
    }
  }
  return 0;
}
