#include <bits/stdc++.h>
using namespace std;
long long modular(long long a, long long b, long long c) {
  if (b == 0) {
    return 1;
  }
  if (b % 2 == 0) {
    return modular(((a * a) % c), b / 2, c);
  } else {
    return ((a % c) * (modular(((a * a) % c), b / 2, c) % c)) % c;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    long long ans = 0;
    vector<pair<long long, long long>> v;
    for (long long i = 1; i <= (k - 1); i++) {
      if (s[(2 * i) - 2] == ')') {
        long long idx = -1;
        for (long long j = (2 * i) - 1;; j++) {
          if (s[j] == '(') {
            idx = j;
            break;
          }
        }
        v.push_back(make_pair((2 * i) - 2, idx));
        s[(2 * i) - 2] = '(';
        s[idx] = ')';
        ans++;
      }
      if (s[(2 * i) - 2] == '(' && s[(2 * i) - 1] == ')') {
        continue;
      } else {
        long long idx = -1;
        for (long long j = (2 * i);; j++) {
          if (s[j] == ')') {
            idx = j;
            break;
          }
        }
        v.push_back(make_pair((2 * i) - 1, idx));
        s[(2 * i) - 1] = ')';
        s[idx] = '(';
        ans++;
      }
    }
    k--;
    for (long long i = (2 * k); i <= (n - 1 - (2 * k)) / 2 + (2 * k); i++) {
      if (s[i] == '(') {
        continue;
      } else {
        long long idx = -1;
        for (long long j = i + 1; j < n; j++) {
          if (s[j] == '(') {
            idx = j;
            break;
          }
        }
        v.push_back(make_pair(i, idx));
        ans++;
        s[i] = '(';
        s[idx] = ')';
      }
    }
    cout << ans << "\n";
    for (long long i = 0; i < v.size(); i++) {
      cout << v[i].first + 1 << " " << v[i].second + 1 << "\n";
    }
  }
  return 0;
}
