#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int total;
  cin >> total;
  while (total--) {
    int n, k, cont_l = 0, cont_r = 0;
    vector<pair<int, int> > ans;
    string s;
    cin >> n >> k;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
      if ((i + 2) / 2 < k) {
        if (i % 2 == 0) {
          if (s[i] != '(') {
            for (int j = i + 1; j < s.size(); j++) {
              if (s[j] == '(') {
                ans.push_back(make_pair(i, j));
                int l = i, r = j;
                while (l < r) {
                  swap(s[l], s[r]);
                  l++;
                  r--;
                }
                break;
              }
            }
          }
        } else {
          if (s[i] != ')') {
            for (int j = i + 1; j < s.size(); j++) {
              if (s[j] == ')') {
                ans.push_back(make_pair(i, j));
                int l = i, r = j;
                while (l < r) {
                  swap(s[l], s[r]);
                  l++;
                  r--;
                }
                break;
              }
            }
          }
        }
      } else {
        int cont = (n - (k - 1) * 2);
        if (cont_l < cont) {
          if (s[i] != '(') {
            for (int j = i + 1; j < s.size(); j++) {
              if (s[j] == '(') {
                ans.push_back(make_pair(i, j));
                int l = i, r = j;
                while (l < r) {
                  swap(s[l], s[r]);
                  l++;
                  r--;
                }
                break;
              }
            }
          }
        } else {
          if (s[i] != ')') {
            for (int j = i + 1; j < s.size(); j++) {
              if (s[j] == ')') {
                ans.push_back(make_pair(i, j));
                int l = i, r = j;
                while (l < r) {
                  swap(s[l], s[r]);
                  l++;
                  r--;
                }
                break;
              }
            }
          }
        }
      }
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;
    }
  }
  return 0;
}
