#include <bits/stdc++.h>
using namespace std;
int in(int &x, int &y, int &z) { return scanf("%d%d%d", &x, &y, &z); }
int in(long long &x, long long &y, long long &z) {
  return scanf("%lld%lld%lld", &x, &y, &z);
}
int in(double &x, double &y, double &z) {
  return scanf("%lf%lf%lf", &x, &y, &z);
}
int in(int &x, long long &y) { return scanf("%d%lld", &x, &y); }
int in(long long &x, int &y) { return scanf("%lld%d", &x, &y); }
int in(int &x, int &y) { return scanf("%d%d", &x, &y); }
int in(long long &x, long long &y) { return scanf("%lld%lld", &x, &y); }
int in(char a[], char b[]) { return scanf("%s%s", a, b); }
int in(double &x, double &y) { return scanf("%lf%lf", &x, &y); }
int in(char &c) { return scanf("%c", &c); }
int in(char s[]) { return scanf("%s", s); }
int in(int &x) { return scanf("%d", &x); }
int in(long long &x) { return scanf("%lld", &x); }
int in(double &x) { return scanf("%lf", &x); }
int in(pair<int, int> &p) { return scanf("%d%d", &p.first, &p.second); }
int in(pair<long long, long long> &p) {
  return scanf("%lld%lld", &p.first, &p.second);
}
int in(pair<double, double> &p) { return scanf("%lf%lf", &p.first, &p.second); }
int in(long double &a) { return scanf("%Lf", &a); }
int in(int &x, int &y, int &z, int &k) {
  return scanf("%d%d%d%d", &x, &y, &z, &k);
}
const int N = 3e5 + 10;
const int M = 1e3 + 10;
int a[N], l[N], r[N];
map<int, int> mp;
int main() {
  int T;
  in(T);
  while (T--) {
    int n;
    in(n);
    for (int i = 1; i <= n; i++) in(a[i]);
    int mx = 0, c = 0;
    for (int i = 1; i <= n; i++) {
      mx = max(mx, a[i]);
      if (mp[a[i]] == 0) mp[a[i]] = 1, c++;
      if (i == c && c == mx) {
        l[i] = mx;
      }
    }
    mp.clear();
    mx = 0;
    c = 0;
    for (int i = n; i >= 1; i--) {
      mx = max(mx, a[i]);
      if (mp[a[i]] == 0) mp[a[i]] = 1, c++;
      if (n - i + 1 == c && c == mx) {
        r[i] = mx;
      }
    }
    vector<pair<int, int>> vc;
    for (int i = 1; i < n; i++) {
      if (l[i] && r[i + 1]) {
        vc.push_back({l[i], r[i + 1]});
      }
    }
    printf("%d\n", vc.size());
    for (auto e : vc) {
      printf("%d %d\n", e.first, e.second);
    }
    mp.clear();
    for (int i = 1; i <= n; i++) l[i] = r[i] = 0;
  }
  return 0;
}
