#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    string t;
    for (int i = 0; i < (k - 1); ++i) t += "()";
    for (int i = 0; i < ((n - 2 * (k - 1)) / 2); ++i) t += '(';
    for (int i = 0; i < ((n - 2 * (k - 1)) / 2); ++i) t += ')';
    vector<pair<int, int> > v;
    for (int i = 0; i < (n); ++i) {
      if (s[i] != t[i]) {
        for (int j = i + 1; j < (n); ++j) {
          if (s[j] == t[i]) {
            reverse(s.begin() + i, s.begin() + j + 1);
            v.emplace_back(pair<int, int>(i, j));
            break;
          }
        }
      }
    }
    cout << (int)v.size() << endl;
    for (int i = 0; i < ((int)v.size()); ++i)
      cout << v[i].first + 1 << " " << v[i].second + 1 << endl;
  }
}
