#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, i, j;
    cin >> n;
    long long int a[n + 1];
    for (i = 0; i < n; i++) cin >> a[i];
    map<long long int, long long int> m1, m2;
    vector<long long int> l1;
    vector<long long int> l2;
    long long int m = -1;
    for (i = 0; i < n; i++) {
      m1[a[i]]++;
      if (m1[a[i]] > 1) break;
      m = max(m, a[i]);
      if (m == i + 1) l1.push_back(i + 1);
    }
    m = -1;
    for (i = n - 1; i >= 0; i--) {
      m2[a[i]]++;
      if (m2[a[i]] > 1) break;
      m = max(m, a[i]);
      if (m == n - i) l2.push_back(n - i);
    }
    vector<long long int>::iterator itr;
    vector<long long int>::iterator itr1;
    long long int cnt = 0;
    vector<pair<long long int, long long int>> p;
    sort(l1.begin(), l1.end());
    sort(l2.begin(), l2.end());
    long long int x1 = l1.size();
    long long int y1 = l2.size();
    i = 0, j = y1 - 1;
    while (i < x1 && j >= 0) {
      if (l1[i] + l2[j] == n) {
        p.push_back(make_pair(l1[i], l2[j]));
        i++;
        j--;
        cnt++;
      } else if ((l1[i] + l2[j]) < n)
        i++;
      else
        j--;
    }
    cout << cnt << "\n";
    for (i = 0; i < p.size(); i++)
      cout << p[i].first << " " << p[i].second << "\n";
  }
}
