#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 3;
long long arr[N];
int main() {
  long long t, n, mx = INT_MIN, mn = INT_MAX, u, v, a, b, d, l = 0;
  cin >> t;
  int abcde = 0;
  while (t--) {
    cin >> n;
    abcde++;
    unordered_map<long long, long long> m1, m2, a1, a2;
    for (long long i = 1; i <= n; i++) cin >> arr[i];
    l = 1;
    for (long long i = 1; i <= n; i++) {
      m1[arr[i]]++;
      while (m1[l] == 1) l++;
      if (i == l - 1) {
        a1[i] = l - 1;
      }
    }
    l = 1;
    for (long long i = n; i >= 1; i--) {
      m2[arr[i]]++;
      while (m2[l] == 1) l++;
      if (n - i + 1 == l - 1) {
        a2[i] = l - 1;
      }
    }
    vector<pair<long long, long long> > ans;
    for (auto x : a1) {
      if (a2[x.first + 1]) ans.push_back({a1[x.first], a2[x.first + 1]});
    }
    cout << ans.size() << "\n";
    sort(ans.begin(), ans.end());
    for (auto p : ans) cout << p.first << " " << p.second << "\n";
  }
}
