#include <bits/stdc++.h>
using namespace std;
const long long inf = 2e9;
const long long base = 998244353;
long long mod = 1e9 + 7;
vector<pair<int, int>> op;
void rev(string& a, int l, int r) {
  for (int i = l; i <= (l + r) / 2; ++i) {
    swap(a[i], a[r - (i - l)]);
  }
}
void solve() {
  op.clear();
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int cur = 0;
  for (int i = 0; i < k - 1; ++i) {
    if (s[cur] != '(') {
      for (int j = cur + 1; j < n; ++j) {
        if (s[j] == '(') {
          op.push_back({cur + 1, j + 1});
          rev(s, cur, j);
          break;
        }
      }
    }
    ++cur;
    if (s[cur] != ')') {
      for (int j = cur + 1; j < n; ++j) {
        if (s[j] == ')') {
          op.push_back({cur + 1, j + 1});
          rev(s, cur, j);
          break;
        }
      }
    }
    ++cur;
  }
  int last = cur + (n - cur) / 2;
  for (cur; cur < last; ++cur) {
    if (s[cur] == '(') continue;
    for (int i = cur + 1; i < n; ++i) {
      if (s[i] == '(') {
        op.push_back({cur + 1, i + 1});
        rev(s, cur, i);
        break;
      }
    }
  }
  cout << op.size() << '\n';
  for (auto c : op) {
    cout << c.first << ' ' << c.second << '\n';
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  auto start = clock();
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  std::cerr << double(clock() - start) / CLOCKS_PER_SEC << std::endl;
  return 0;
}
