#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m, k, test;
  string s;
  cin >> test;
  while (test--) {
    cin >> n >> k >> s;
    cout << (2 * (k - 1)) + ((n - (2 * (k - 1))) / 2) << endl;
    int fast = 0, last = n - 1;
    for (int m = 1; m < k; ++m) {
      for (int i = fast; i < n; ++i) {
        if (s[i] == '(') {
          for (int j = fast, p = i; j <= p; ++j, --p) swap(s[j], s[p]);
          ++fast;
          cout << fast << " " << i + 1 << endl;
          break;
        }
      }
      for (int i = fast; i < n; ++i) {
        if (s[i] == ')') {
          for (int j = fast, p = i; j <= p; ++j, --p) swap(s[j], s[p]);
          ++fast;
          cout << fast << " " << i + 1 << endl;
          break;
        }
      }
    }
    for (int i = n - 1; i >= 0 && abs((last - 1) - n) <= ((n / 2) - k + 2);
         --i) {
      if (s[i] == ')') {
        for (int j = i, p = last; j <= p; ++j, --p) swap(s[j], s[p]);
        cout << i + 1 << " " << last + 1 << endl;
        --last;
      }
    }
  }
  return 0;
}
