#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n], loc = 0, loc2 = 0;
    map<int, int> mp, mp2;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      mp[a[i]]++;
      if (mp[a[i]] == 2 && !loc) loc = i;
      if (mp[a[i]] > 2) loc = -1;
    }
    for (int i = n - 1; i >= 0; i--) {
      mp2[a[i]]++;
      if (mp2[a[i]] == 2 && !loc2) loc2 = i;
    }
    if (loc == -1) {
      puts("0");
      continue;
    }
    set<int> st;
    int mx = -1;
    pair<int, int> ans[2];
    mp2.clear();
    for (int i = 0; i < loc; i++) {
      st.insert(a[i]);
      mx = max(mx, a[i]);
      mp2[a[i]]++;
      if (mp2[a[i]] > 1) {
        mx = -1;
        break;
      }
    }
    if (st.size() != mx) loc = n;
    st.clear();
    mx = -1;
    mp2.clear();
    for (int i = loc; i < n; i++) {
      st.insert(a[i]);
      mx = max(mx, a[i]);
      mp2[a[i]]++;
      if (mp2[a[i]] > 1) {
        mx = -1;
        break;
      }
    }
    int sz = 0;
    if (st.size() == mx) {
      ans[0].first = loc;
      ans[0].second = n - (loc);
      sz++;
    }
    st.clear();
    mx = -1;
    mp2.clear();
    for (int i = n - 1; i > loc2; i--) {
      st.insert(a[i]);
      mx = max(mx, a[i]);
      mp2[a[i]]++;
      if (mp2[a[i]] > 1) {
        mx = -1;
        break;
      }
    }
    if (st.size() != mx) loc2 = -1;
    st.clear();
    mx = -1;
    mp2.clear();
    for (int i = loc2; i >= 0; i--) {
      st.insert(a[i]);
      mx = max(mx, a[i]);
      mp2[a[i]]++;
      if (mp2[a[i]] > 1) {
        mx = -1;
        break;
      }
    }
    if (st.size() == mx && loc2 + 1 != loc) {
      ans[sz].first = loc2 + 1;
      ans[sz].second = min(n - 1, n - (loc2 + 1));
      sz++;
    }
    cout << sz << endl;
    for (int i = 0; i < sz; i++)
      cout << ans[i].first << " " << ans[i].second << endl;
  }
  return 0;
}
