#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int f;
  cin >> f;
  for (int kek = 0; kek < f; kek++) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    int pairs = (k - 1);
    int last = n / 2 - k + 1;
    vector<pair<int, int>> ans;
    for (int i = 0; i < pairs; i++) {
      if (s[2 * i] == ')') {
        int l = 2 * i;
        int r = l + 1;
        while (s[r] != '(') r++;
        ans.push_back(make_pair(l, r));
        for (int j = l; j <= (l + r) / 2; j++) swap(s[j], s[r + l - j]);
      }
      if (s[2 * i + 1] == '(') {
        int l = 2 * i + 1;
        int r = l + 1;
        while (s[r] != ')') r++;
        ans.push_back(make_pair(l, r));
        for (int j = l; j <= (l + r) / 2; j++) swap(s[j], s[r + l - j]);
      }
    }
    for (int i = 2 * pairs; i < 2 * pairs + last; i++) {
      if (s[i] == ')') {
        int l = i;
        int r = l + 1;
        while (s[r] != '(') r++;
        ans.push_back(make_pair(l, r));
        for (int j = l; j <= (l + r) / 2; j++) swap(s[j], s[r + l - j]);
      }
    }
    cout << ans.size() << '\n';
    for (int i = 0; i < ans.size(); i++)
      cout << ans[i].first + 1 << ' ' << ans[i].second + 1 << '\n';
  }
}
