#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, k, c = 0;
  cin >> n >> k;
  string s;
  cin >> s;
  vector<pair<long long, long long> > ans;
  long long d = 0, d1 = 0;
  for (long long int i = 0; i < n; i++) {
    if (c == k - 1) {
      if (2 * d1++ < n - 2 * k + 2) {
        if (s[i] != '(') {
          long long ind = 0;
          for (long long j = i + 1; j < n; j++)
            if (s[j] == '(') {
              ind = j;
              break;
            }
          reverse(s.begin() + i, s.begin() + ind + 1);
          ans.push_back({i, ind});
        }
      } else {
        if (s[i] != ')') {
          long long ind = 0;
          for (long long j = i + 1; j < n; j++)
            if (s[j] == ')') {
              ind = j;
              break;
            }
          reverse(s.begin() + i, s.begin() + ind + 1);
          ans.push_back({i, ind});
        }
      }
      continue;
    }
    if (d == 0 && s[i] != '(') {
      long long ind = 0;
      for (long long j = i + 1; j < n; j++)
        if (s[j] == '(') {
          ind = j;
          break;
        }
      reverse(s.begin() + i, s.begin() + ind + 1);
      ans.push_back({i, ind});
    } else if (d == 1 && s[i] != ')') {
      long long ind = 0;
      for (long long j = i + 1; j < n; j++)
        if (s[j] == ')') {
          ind = j;
          break;
        }
      reverse(s.begin() + i, s.begin() + ind + 1);
      ans.push_back({i, ind});
    }
    d++, d %= 2;
    if (d == 0) c++;
  }
  cout << ans.size() << "\n";
  for (auto i : ans) cout << ++i.first << " " << ++i.second << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long test_cases = 1;
  cin >> test_cases;
  for (long long t = 1; t <= test_cases; t++) solve();
  return 0;
}
