#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200 * 1000 + 10;
const int MOD = 1000 * 1000 * 1000 + 7;
int a[MAXN];
vector<int> pos[MAXN], vec, ans;
map<int, int> mp, mark;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    ans.clear();
    mark.clear();
    mp.clear();
    vec.clear();
    int n;
    cin >> n;
    int p1 = -1, p2 = -1, mx1 = -1, mx2 = -1;
    bool bad1 = 0, bad2 = 0, ok = 1;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      vec.push_back(a[i]);
      pos[a[i]].push_back(i);
      if ((int)pos[a[i]].size() > 2) ok = 0;
      if (a[i] == 1) {
        if (p1 == -1)
          p1 = i;
        else {
          if (p2 == -1)
            p2 = i;
          else
            ok = 0;
        }
      }
    }
    if (!ok || p1 == -1 || p2 == -1) {
      cout << 0 << endl;
      goto hell;
    }
    for (int i = 0; i < p1; i++) {
      mx1 = max(mx1, a[i]);
      if (mark[a[i]] == 1) {
        bad1 = 1;
        break;
      }
      mark[a[i]] = 1;
    }
    if (bad1) {
      cout << 0 << endl;
      goto hell;
    }
    for (int i = p1; i < n; i++) {
      if (mark[a[i]] == 1) break;
      mark[a[i]] = 1;
      mx1 = max(mx1, a[i]);
      if (mx1 == i + 1) mp[i]++;
    }
    for (int i = n - 1; i > p2; i--) {
      mx2 = max(mx2, a[i]);
      if (mark[a[i]] == 2) {
        bad2 = 1;
        break;
      }
      mark[a[i]] = 2;
    }
    if (bad2) {
      cout << 0 << endl;
      goto hell;
    }
    for (int i = p2; i > -1; i--) {
      if (mark[a[i]] == 2) break;
      mark[a[i]] = 2;
      mx2 = max(mx2, a[i]);
      if (mx2 == n - i && mp[i - 1]) ans.push_back(n - i);
    }
    cout << (int)ans.size() << endl;
    for (auto a : ans) cout << n - a << ' ' << a << endl;
  hell:;
    for (auto u : vec) pos[u].clear();
  }
  return 0;
}
