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