#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t, n, k;
  string s;
  vector<pair<int, int>> path;
  cin >> t;
  while (t--) {
    cin >> n >> k >> s;
    k--;
    path.clear();
    for (int i = 0; i < n; i++) {
      if (k > 0) {
        if (i % 2 == 0) {
          int pos = -1;
          for (int j = i; j < n; j++) {
            if (s[j] == '(') {
              pos = j;
              break;
            }
          }
          path.emplace_back(i + 1, pos + 1);
          reverse(s.begin() + i, s.begin() + pos + 1);
        } else {
          int pos = -1;
          for (int j = i; j < n; j++) {
            if (s[j] == ')') {
              pos = j;
              break;
            }
          }
          path.emplace_back(i + 1, pos + 1);
          reverse(s.begin() + i, s.begin() + pos + 1);
          k--;
        }
      } else {
        int pos = -1;
        for (int j = i; j < n; j++) {
          if (s[j] == '(') {
            pos = j;
            break;
          }
        }
        if (pos == -1) {
          continue;
        }
        path.emplace_back(i + 1, pos + 1);
        reverse(s.begin() + i, s.begin() + pos + 1);
      }
    }
    cout << path.size() << '\n';
    for (pair<int, int> p : path) {
      cout << p.first << ' ' << p.second << '\n';
    }
  }
  return 0;
}
