#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18 + 7;
const long double EPS = 1e-8;
const long long MAXI = 20000;
const long long MOD = 16714589;
const long long MAXST = 2000;
const long long P = 40;
const long double PI = 3.14159265358979323;
pair<long long, long long> a[210000];
signed main() {
  {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(0);
    cerr << fixed << setprecision(10);
  };
  long long t;
  cin >> t;
  for (long long q = 0; q < t; q++) {
    long long n, k;
    cin >> n >> k;
    string second;
    cin >> second;
    long long l = 0;
    long long k1 = second.size() / 2 - k + 1;
    vector<pair<long long, long long> > ans;
    while (k > 1) {
      if (second[l] != '(')
        for (long long i = l + 1; i < n; i++)
          if (second[i] == '(') {
            ans.emplace_back(l + 1, i + 1);
            reverse(second.begin() + l, second.begin() + i + 1);
            break;
          }
      l++;
      if (second[l] != ')') {
        for (long long i = l + 1; i < n; i++)
          if (second[i] == ')') {
            ans.emplace_back(l + 1, i + 1);
            reverse(second.begin() + l, second.begin() + i + 1);
            break;
          }
      }
      l++;
      k--;
    }
    for (long long t = 0; t < k1; t++, l++) {
      if (second[l] != '(')
        for (long long i = l + 1; i < n; i++)
          if (second[i] == '(') {
            ans.emplace_back(l + 1, i + 1);
            reverse(second.begin() + l, second.begin() + i + 1);
            break;
          }
    }
    for (long long t = 0; t < k1; t++, l++) {
      if (second[l] != ')')
        for (long long i = l + 1; i < n; i++)
          if (second[i] == ')') {
            ans.emplace_back(l + 1, i + 1);
            reverse(second.begin() + l, second.begin() + i + 1);
            break;
          }
    }
    cout << ans.size() << '\n';
    for (auto i : ans) cout << i.first << ' ' << i.second << '\n';
  }
  return 0;
}
