#include <bits/stdc++.h>
using namespace std;
int n, x, i, t, a[200005], max2[200005], fr1[200005], fr2[200005], sol[200005];
void solve() {
  int max1 = 0, pairs2 = 0;
  int k = 0;
  for (i = 1; i <= n; i++) max2[i] = fr1[i] = fr2[i] = 0;
  int ok = 0;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    fr2[a[i]]++;
    if (fr2[i] == 3 && ok == 0) {
      cout << "0\n";
      ok = 1;
    }
    if (fr2[a[i]] == 2) pairs2++;
  }
  if (ok) return;
  max2[n] = a[n];
  for (i = n - 1; i >= 2; i--) max2[i] = max(max2[i + 1], a[i]);
  for (i = 1; i < n; i++) {
    max1 = max(max1, a[i]);
    if (fr2[a[i]] == 2) pairs2--;
    fr2[a[i]]--;
    fr1[a[i]]++;
    if (fr1[a[i]] == 2) break;
    if (pairs2 == 0 && max1 == i && max2[i + 1] == n - i) sol[++k] = i;
  }
  cout << k << "\n";
  while (k--) {
    cout << sol[k + 1] << ' ' << n - sol[k + 1] << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    solve();
  }
  return 0;
}
