#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const long long mod = 1e9 + 7;
const long double eps = 1e-9;
const long double pi = atan2(0, -1);
void solve(string s, long long k) {
  k--;
  long long n = s.size();
  vector<long long> a(n, 0);
  for (long long i = 0; i < n; ++i) {
    if (s[i] == '(')
      a[i] = 1;
    else
      a[i] = 0;
  }
  vector<long long> b(n, 0);
  long long bi = 0;
  for (long long i = 0; i < 2 * k; i += 2) {
    b[i] = 1;
    b[i + 1] = 0;
  }
  for (long long i = 0; i < (n - 2 * k) / 2; ++i) b[i + 2 * k] = 1;
  vector<pair<long long, long long>> res;
  for (long long i = 0; i < n; ++i) {
    if (a[i] == b[i]) continue;
    long long j = i + 1;
    while (a[j] != b[i]) j++;
    res.push_back({i, j});
    reverse(a.begin() + i, a.begin() + j + 1);
  }
  cout << res.size() << "\n";
  for (auto i : res) cout << i.first + 1 << " " << i.second + 1 << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(15);
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    string s;
    cin >> n >> k >> s;
    solve(s, k);
  }
  return 0;
}
