#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc;
  cin >> tc;
  while (tc--) {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    string t;
    for (int i = 0; i < k - 1; ++i) {
      t += "()";
    }
    t += string(n / 2 - k + 1, '(');
    t += string(n / 2 - k + 1, ')');
    vector<pair<int, int> > ans;
    for (int i = 0; i < n - 1; ++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);
            ans.push_back({i + 1, j + 1});
            break;
          }
        }
      }
    }
    cout << ans.size() << '\n';
    for (auto &p : ans) {
      cout << p.first << ' ' << p.second << '\n';
    }
  }
}
