#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T min(T &x, const T &y) {
  return x > y ? y : x;
}
template <class T>
inline T max(T &x, const T &y) {
  return x < y ? y : x;
}
long long read() {
  long long c = getchar(), Nig = 1, x = 0;
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') Nig = -1, c = getchar();
  while (isdigit(c)) x = ((x << 1) + (x << 3)) + (c ^ '0'), c = getchar();
  return Nig * x;
}
const long long inf = 1e18;
const int maxn = 2e5 + 7;
const int mod = 1e9 + 7;
int main() {
  int T = read();
  while (T--) {
    string s, t;
    int n = read(), m = read();
    cin >> s;
    for (int i = 0; i < n / 2 - (m - 1); i++) {
      t.push_back('(');
    }
    for (int i = 0; i < n / 2 - (m - 1); i++) {
      t.push_back(')');
    }
    for (int i = 0; i < m - 1; i++) {
      t.push_back('(');
      t.push_back(')');
    }
    vector<pair<int, int> > ans;
    for (int i = 0; i < n; i++) {
      if (s[i] != t[i]) {
        int j = i + 1;
        while (j < n && s[j] != t[i]) j++;
        reverse(s.begin() + i, s.begin() + j + 1);
        ans.emplace_back(i + 1, j + 1);
      }
    }
    printf("%d\n", ans.size());
    for (int i = 0; i < ans.size(); i++) {
      printf("%d %d\n", ans[i].first, ans[i].second);
    }
  }
  return 0;
}
