#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int ac = 1e6 + 5;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    cout << n << '\n';
    string s;
    cin >> s;
    int p = 0;
    for (int i = 0; i < n / 2 - k + 1; i++) {
      int j = p;
      while (s[j] != '(') j++;
      cout << p + 1 << ' ' << j + 1 << '\n';
      reverse(s.begin() + p, s.begin() + j + 1);
      p++;
    }
    for (int i = 0; i < n / 2 - k + 1; i++) {
      int j = p;
      while (s[j] != ')') j++;
      cout << p + 1 << ' ' << j + 1 << '\n';
      reverse(s.begin() + p, s.begin() + j + 1);
      p++;
    }
    for (int i = 0; i < (k - 1) * 2; i++) {
      if (i % 2 == 0) {
        int j = p;
        while (s[j] != '(') j++;
        cout << p + 1 << ' ' << j + 1 << '\n';
        reverse(s.begin() + p, s.begin() + j + 1);
        p++;
      } else {
        int j = p;
        while (s[j] != ')') j++;
        cout << p + 1 << ' ' << j + 1 << '\n';
        reverse(s.begin() + p, s.begin() + j + 1);
        p++;
      }
    }
  }
}
