#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
char S[2005], A[2] = {'(', ')'};
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    vector<pii> ans;
    int N, K;
    cin >> N >> K;
    cin >> S + 1;
    for (int i = 1; i <= K * 2 - 2; ++i) {
      char t = A[~i & 1];
      if (S[i] == t)
        continue;
      else {
        int j = i;
        while (S[j] != t) j++;
        ans.emplace_back(i, j);
        for (int k = 0; i + k < j - k; ++k) swap(S[i + k], S[j - k]);
      }
    }
    for (int i = 0; i < N / 2 - K + 1; ++i) {
      int x = K * 2 - 1 + i;
      int y = x;
      while (S[y] == ')') y++;
      if (x == y) continue;
      ans.emplace_back(x, y);
      for (int k = 0; x + k < y - k; ++k) swap(S[x + k], S[y - k]);
    }
    cout << ans.size() << '\n';
    for (auto i : ans) cout << i.first << ' ' << i.second << '\n';
  }
  return 0;
}
