#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  for (long long ii = 0; ii < t; ii++) {
    long long n, k;
    cin >> n >> k;
    string s;
    char t[n];
    cin >> s;
    bool b = 1;
    long long kol = 0;
    for (long long i = n - 1; i >= 0; i--) {
      if (kol < k) {
        if (b) {
          t[i] = ')';
          kol++;
        } else {
          t[i] = '(';
        }
        b = !b;
      } else {
        if (i < n / 2 - k + 1) {
          t[i] = '(';
        } else {
          t[i] = ')';
        }
      }
    }
    vector<pair<long long, long long>> ans;
    for (long long i = n - 1; i >= 0; i--) {
      if (s[i] != t[i]) {
        for (long long j = 0; j < i; j++) {
          if (s[j] == t[i]) {
            ans.push_back({j + 1, i + 1});
            for (long long x = j; x <= (i + j) / 2; x++) {
              swap(s[x], s[i - (x - j)]);
            }
            break;
          }
        }
      }
    }
    cout << ans.size() << '\n';
    for (auto i : ans) {
      cout << i.first << ' ' << i.second << '\n';
    }
  }
  return 0;
}
