#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int T;
  cin >> T;
  while (T != 0) {
    long long int n, i;
    cin >> n;
    long long int A[n];
    long long int B[200001];
    long long int C[200001];
    long long int m, f;
    long long int o, t;
    long long int w, z;
    set<long long int> perm;
    set<long long int> cern;
    memset(B, 0, 200001);
    memset(C, 0, 200001);
    for (i = 0; i < n; i += 1) {
      cin >> A[i];
      B[A[i]] += 1;
    }
    m = 0;
    f = 1;
    for (i = 0; i < n; i += 1) {
      if (A[i] > m) m = A[i];
    }
    o = 0;
    t = 0;
    for (i = 1; i <= m; i += 1) {
      if (B[i] != 1 && B[i] != 2) {
        f = 0;
      } else {
        if (B[i] == 1) o++;
        if (B[i] == 2) t++;
      }
    }
    if (f == 0) {
      cout << "0"
           << "\n";
    } else {
      set<long long int>::iterator ps;
      set<long long int>::iterator it;
      long long int c;
      w = 0;
      z = 0;
      c = 0;
      long long int l;
      l = n - 1;
      vector<long long int> As;
      vector<long long int> Bs;
      for (i = 0; i < n; i += 1) {
        cern.insert(A[i]);
      }
      for (i = 0; i < l; i += 1) {
        perm.insert(A[i]);
        B[A[i]] -= 1;
        C[A[i]] += 1;
        if (B[A[i]] == 1) {
          t--;
          o++;
        }
        if (B[A[i]] == 0) {
          cern.erase(A[i]);
          o--;
        }
        if (C[A[i]] == 1) {
          w++;
        }
        if (C[A[i]] == 2) {
          w--;
          z++;
        }
        ps = perm.end();
        it = cern.end();
        ps--;
        it--;
        if (*ps == perm.size() && *it == cern.size() && t == 0 && z == 0) {
          As.push_back(*ps);
          Bs.push_back(*it);
          c += 1;
        }
      }
      cout << c << "\n";
      for (i = 0; i < As.size(); i += 1) {
        cout << As[i] << " " << Bs[i] << "\n";
      }
    }
    T -= 1;
  }
  return 0;
}
