#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const long double EPS = 1e-7;
const long double PI = 3.1415926535897;
const long long mod = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  long long a = -INF, b = INF;
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    long long ko = 0, ks = 0;
    for (long long i = 0; i < n; ++i)
      if (s[i] == '(')
        ko++;
      else
        ks++;
    vector<pair<long long, long long> > res;
    for (long long i = 0; i < (k - 1) * 2; ++i) {
      char c;
      if (i % 2 == 0)
        c = '(';
      else
        c = ')';
      long long ot;
      for (long long j = i; j < n; ++j)
        if (s[j] == c) {
          ot = j;
          break;
        }
      reverse(s.begin() + i, s.begin() + ot + 1);
      res.push_back({i, ot});
    }
    long long ost = n - (k - 1) * 2;
    for (long long i = (k - 1) * 2; ost > 0; ++i) {
      long long ot;
      for (long long j = i; j < n; ++j)
        if (s[j] == '(') {
          ot = j;
          break;
        }
      reverse(s.begin() + i, s.begin() + ot + 1);
      res.push_back({i, ot});
      ost -= 2;
    }
    cout << res.size() << '\n';
    for (auto x : res) cout << x.first + 1 << ' ' << x.second + 1 << '\n';
  }
}
