#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int _ = 0; _ < t; ++_) {
    long long n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    string oks;
    for (int i = 0; i < n / 2 - k + 1; ++i) {
      oks.push_back('(');
    }
    for (int i = 0; i < n / 2 - k + 1; ++i) {
      oks.push_back(')');
    }
    for (int i = 0; i < k - 1; ++i) {
      oks.push_back('(');
      oks.push_back(')');
    }
    vector<pair<int, int>> res;
    for (int i = 0; i < n; ++i) {
      if (oks[i] != s[i]) {
        for (int j = i; j < n; ++j) {
          if (s[j] == oks[i]) {
            res.push_back({i + 1, j + 1});
            s[j] = s[i];
            s[i] = oks[i];
            break;
          }
        }
      }
    }
    cout << res.size() << "\n";
    for (auto el : res) cout << el.first << " " << el.second << "\n";
  }
}
