#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007LL;
long long large = 2000000000000000000LL;
int n;
vector<pair<int, int> > e;
vector<int> f(string s) {
  vector<int> p(s.length() + 1, 0);
  for (int i = 1; i <= (int)s.length(); i++) {
    if (s[i - 1] == '(')
      p[i] = 1;
    else
      p[i] = -1;
    p[i] += p[i - 1];
  }
  return p;
}
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    int k;
    cin >> k;
    string s;
    cin >> s;
    vector<int> p = f(s);
    e.clear();
    int l = -1;
    for (int i = 1; i <= n; i++) {
      if (l != -1) {
        if (p[i] == 0) {
          e.push_back(pair<int, int>(l, i - 1));
          reverse(s.begin() + l, s.begin() + i);
          l = -1;
        }
      } else {
        if (p[i] < 0) {
          l = i - 1;
        }
      }
    }
    p = f(s);
    int cnt = 0;
    for (int i = 1; i <= n; i++)
      if (p[i] == 0) cnt++;
    while (cnt > k) {
      for (int i = 1; i <= n; i++) {
        if (p[i] == 0) {
          reverse(s.begin() + i - 1, s.begin() + i + 1);
          e.push_back(pair<int, int>(i - 1, i));
          cnt--;
          break;
        }
      }
      p = f(s);
    }
    while (cnt < k) {
      int l = -1;
      for (int i = 1; i <= n; i++) {
        if (l == -1) {
          if (p[i] == 2) l = i - 1;
        } else {
          if (p[i] < p[i - 1]) {
            reverse(s.begin() + l, s.begin() + i);
            e.push_back(pair<int, int>(l, i - 1));
            cnt++;
            break;
          }
        }
      }
      p = f(s);
    }
    cout << e.size() << endl;
    for (int i = 0; i < (int)e.size(); i++)
      cout << e[i].first + 1 << " " << e[i].second + 1 << endl;
  }
  return 0;
}
