#include <bits/stdc++.h>
using namespace std;
int n, x, m;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int Tes = 1;
  cin >> Tes;
  int req;
  while (Tes--) {
    cin >> n >> req;
    string second;
    cin >> second;
    vector<pair<int, int>> v;
    string s2 = "()";
    for (int i = 0; i < 2 * (req - 1); i++) {
      int c = ((i) & (1));
      if (s2[c] != second[i])
        for (int j = i; j < n; j++) {
          if (second[j] == s2[c] && (j != i)) {
            second.erase(second.begin() + j);
            second.insert(second.begin() + i, s2[c]);
            v.push_back({i, j});
            break;
          }
        }
    }
    int len = (n - 2 * (req - 1));
    int half = len >> 1;
    int j = 2 * (req - 1);
    for (int i = 2 * (req - 1); i < (2 * (req - 1) + half); i++) {
      j = max(j, i);
      if (second[i] == ')')
        for (; j < n; j++) {
          if (second[j] == '(') {
            second.erase(second.begin() + j);
            second.insert(second.begin() + i, '(');
            v.push_back({i, j});
            break;
          }
        }
    }
    cout << v.size() << endl;
    for (auto i : v) cout << i.first + 1 << ' ' << i.second + 1 << endl;
  }
}
