#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const long long INF = 1e18;
vector<pair<long long, long long>> ans;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    ans.clear();
    long long n, m;
    string s;
    cin >> n >> m;
    cin >> s;
    for (int i = 0; i < n / 2; i++) {
      if (i < n / 2) {
        if (s[i] == '(') continue;
        for (int j = i + 1; j < n; j++) {
          if (s[j] == '(') {
            for (int k = i; k <= (i + j) / 2; k++) {
              swap(s[k], s[j - (k - i)]);
            }
            ans.push_back({i, j});
            break;
          }
        }
      }
    }
    for (int i = n / 2 - 1; i > 0; i--) {
      long long j = n - 1 - i;
      for (int k = i; k <= (i + j) / 2; k++) {
        swap(s[k], s[j - (k - i)]);
      }
      ans.push_back({i, j});
    }
    long long i = 2 * m - 1;
    long long j = n - 2;
    for (int k = i; k <= (i + j) / 2; k++) {
      swap(s[k], s[j - (k - i)]);
    }
    if (m != n / 2) ans.push_back({2 * m - 1, n - 2});
    cout << ans.size() << endl;
    for (auto rr : ans) {
      cout << rr.first + 1 << " " << rr.second + 1 << endl;
    }
  }
}
