#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    k--;
    string s;
    cin >> s;
    string t;
    for (int i = 0; i < k; i++) t += "()";
    for (int i = 0; i < n / 2 - k; i++) t += '(';
    for (int i = 0; i < n / 2 - k; i++) t += ')';
    vector<pair<int, int> > ans;
    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]) {
            ans.push_back({i + 1, j + 1});
            for (int x = 0; x < n; x++)
              if (i + x < j - x) swap(s[i + x], s[j - x]);
            break;
          }
      }
    cout << ans.size() << endl;
    for (auto x : ans) cout << x.first << ' ' << x.second << endl;
  }
}
