#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<int> open;
    for (int i = 0; i < n; ++i) {
      if (s[i] == '(') {
        open.push_back(i);
      }
    }
    vector<pair<int, int>> ans;
    for (int i = 0; i < n / 2; ++i) {
      ans.push_back({i + 1, open[i] + 1});
    }
    for (int j = 1, l = 1; j < n, l < k; j += 2, ++l) {
      int pos = n / 2 + j / 2;
      ans.push_back({j + 1, pos + 1});
    }
    cout << ans.size() << "\n";
    for (auto &p : ans) {
      cout << p.first << " " << p.second << "\n";
    }
  }
}
