#include <bits/stdc++.h>
using namespace std;
int t;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    int n, k;
    string s;
    cin >> n >> k >> s;
    int now = 0;
    cout << n << endl;
    k--;
    for (int i = 0; i < n - 1; i++) {
      if (now == k) {
        bool flag = false;
        int tmp;
        for (int j = i; j < n; j++)
          if (s[j] == ')') {
            cout << i + 1 << " " << j + 1 << endl;
            flag = true;
            tmp = j + 1;
            break;
          }
        if (flag)
          reverse(s.begin() + i, s.begin() + tmp);
        else
          cout << i + 1 << " " << i + 1 << endl;
      } else {
        if (i % 2) {
          bool flag = false;
          int tmp;
          for (int j = i; j < n; j++)
            if (s[j] == ')') {
              now++;
              cout << i + 1 << ' ' << j + 1 << endl;
              flag = true;
              tmp = j + 1;
              break;
            }
          if (flag)
            reverse(s.begin() + i, s.begin() + tmp);
          else
            cout << i + 1 << " " << i + 1 << endl;
        } else {
          bool flag = false;
          int tmp;
          for (int j = i; j < n; j++)
            if (s[j] == '(') {
              cout << i + 1 << ' ' << j + 1 << endl;
              flag = true;
              tmp = j + 1;
              break;
            }
          if (flag)
            reverse(s.begin() + i, s.begin() + tmp);
          else
            cout << i + 1 << " " << i + 1 << endl;
        }
      }
    }
    int tmp = 0;
    for (int i = s.size() - 1; i >= 0; i--)
      if (s[i] == '(')
        tmp++;
      else
        break;
    cout << n - 2 * tmp + 1 << " " << n << endl;
    reverse(s.begin() + n - 2 * tmp, s.end());
  }
  return 0;
}
