#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
const double PI = acos(-1.0);
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long k;
    cin >> k;
    char s[n];
    for (long long i = 0; i < n; i++) {
      cin >> s[i];
    }
    vector<pair<long long, long long>> ans;
    for (long long i = 0; i < n; i += 2) {
      if (s[i] == '(') {
        if (s[i + 1] == ')') {
          continue;
        }
        for (long long j = i + 2; j < n; j++) {
          if (s[j] == ')') {
            ans.push_back({i + 1, j});
            reverse(s + i + 1, s + j + 1);
            break;
          }
        }
      } else {
        for (long long j = i + 1; j < n; j++) {
          if (s[j] == '(') {
            ans.push_back({i, j});
            reverse(s + i, s + j + 1);
            break;
          }
        }
      }
    }
    long long done = n / 2;
    for (long long i = 1; i < n && done > k; i += 2) {
      ans.push_back({i, i + 1});
      done--;
    }
    cout << ans.size() << "\n";
    for (auto x : ans) {
      cout << x.first + 1 << " " << x.second + 1 << "\n";
    }
  }
}
