#include <bits/stdc++.h>
using namespace std;
const long long M = 998244353;
const int N = 2 * 1e5 + 5;
const long long INF = 1e18;
long long n, k, q;
string s;
vector<pair<int, int> > v;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> q;
  while (q--) {
    cin >> n >> k;
    cin >> s;
    int x = n;
    string t = "";
    k--;
    for (int i = 0; i < k; i++) {
      t += '(';
      t += ')';
    }
    x -= k * 2;
    for (int i = 1; i <= x / 2; i++) t += '(';
    for (int i = 1; i <= x / 2; i++) t += ')';
    for (int i = 0; i < n; i++) {
      if (s[i] != t[i]) {
        int pos = 0;
        for (int j = i + 1; j < n; j++) {
          if (s[j] == t[i]) {
            pos = j;
            break;
          }
        }
        reverse(s.begin() + i, s.begin() + pos + 1);
        v.push_back({i + 1, pos + 1});
      }
    }
    cout << v.size() << "\n";
    for (int i = 0; i < v.size(); i++)
      cout << v[i].first << ' ' << v[i].second << "\n";
    v.clear();
  }
  return 0;
}
