#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int i, j;
    string a;
    cin >> a;
    i = 0;
    vector<pair<int, int> > v;
    v.clear();
    while (1) {
      if (k == 1) {
        int x = a.length() - i;
        for (int y = i; y < i + x / 2; y++)
          if (a[y] == ')') {
            int z;
            for (z = y + 1; z < a.length(); z++)
              if (a[z] == '(') break;
            v.push_back(make_pair(y, z));
            int j = y;
            while (z > j) swap(a[z], a[j]), z--, j++;
          }
        break;
      } else {
        if (a[i] == ')') {
          int y;
          for (y = i + 1; y < a.length(); y++)
            if (a[y] == '(') break;
          v.push_back(make_pair(i, y));
          int j = i;
          while (y > j) swap(a[y], a[j]), y--, j++;
        } else {
          int y;
          for (y = i + 1; y < a.length(); y++)
            if (a[y] == ')') break;
          if (y != i + 1) {
            v.push_back(make_pair(i + 1, y));
            int j = i + 1;
            while (y > j) swap(a[y], a[j]), y--, j++;
          }
        }
        k--;
        i += 2;
      }
    }
    cout << v.size() << "\n";
    for (i = 0; i < v.size(); i++)
      cout << v[i].first + 1 << " " << v[i].second + 1 << "\n";
  }
  return 0;
}
