#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long arr[n], brr[n];
    for (int i = 0; i < n; i++) {
      char ch;
      cin >> ch;
      if (ch == '(')
        arr[i] = 1;
      else
        arr[i] = -1;
    }
    long long count = 0;
    for (int i = 0; i < n; i++) {
      if (count != k - 1) {
        brr[i] = 1;
        brr[i + 1] = -1;
        count++;
        i++;
      } else {
        if (i < n / 2 + k - 1)
          brr[i] = 1;
        else
          brr[i] = -1;
      }
    }
    vector<pair<long long, long long> > ans;
    for (int i = 0; i < n; i++) {
      if (arr[i] != brr[i]) {
        long long ind;
        vector<long long> temp;
        for (int j = i + 1; j < n; j++) {
          if (brr[i] == arr[j]) {
            ind = j;
            break;
          }
          temp.push_back(arr[i]);
        }
        swap(arr[i], arr[ind]);
        ans.push_back(make_pair(i + 1, ind + 1));
        ind = i + 1;
        for (int j = temp.size() - 1; j >= 0; j--) {
          arr[ind] = temp[j];
          ind++;
        }
      }
    }
    cout << ans.size() << "\n";
    for (int i = 0; i < ans.size(); i++)
      cout << ans[i].first << ' ' << ans[i].second << '\n';
  }
  return 0;
}
