#include <bits/stdc++.h>
using namespace std;
int t;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cin >> t;
  while (t--) {
    int n, k;
    long long ans = 0, tmp;
    string str;
    vector<pair<int, int>> answer;
    cin >> n >> k;
    cin >> str;
    for (int i = 0; i < n; i++) {
      if ((i % 2 == 0 && str[i] == '(') || (i % 2 == 1 && str[i] == ')'))
        continue;
      for (int j = i; j < n; j++) {
        if (str[j] == '(' && i % 2 == 0) {
          ans++;
          answer.push_back({i + 1, j + 1});
          reverse(str.begin() + i, str.begin() + j + 1);
          break;
        }
        if (str[j] == ')' && i % 2 == 1) {
          ans++;
          answer.push_back({i + 1, j + 1});
          reverse(str.begin() + i, str.begin() + j + 1);
          break;
        }
      }
    }
    if (k * 2 != n) {
      ans++;
      answer.push_back({k * 2, n - 1});
    }
    cout << ans << '\n';
    for (int k = 0; k < answer.size(); k++) {
      cout << answer[k].first << " " << answer[k].second << '\n';
    }
  }
  return 0;
}
