#include <bits/stdc++.h>   using namespace std;   const long long M = 1e9 + 7;   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long t;     cin >> t;     while (t--) {       long long n;       cin >> n;       long long a[n];       map<long long, long long> m;       map<long long, long long> m1;       map<long long, long long> m2;       map<long long, long long> m3;       vector<pair<long long, long long>> v;       for (long long i = 0; i < n; i++) {         cin >> a[i];         m2[a[i]]++;       }       for (auto it = m2.begin(); it != m2.end(); it++) {         m3[it->second]++;       }       for (long long i = 0; i < n - 1; i++) {         long long x = ++m[a[i]];         m1[x]++;         m1[x - 1]--;         long long y = m2[a[i]];         if (y == 1) {           m2.erase(m2.find(a[i]));         } else           m2[a[i]]--;         m3[y]--;         m3[y - 1]++;         auto it = m.end();         it--;         x = it->first;         it = m2.end();         it--;         y = it->first;         if (x == m.size() && y == m2.size() && m1[1] == x && m3[1] == y) {           v.push_back({x, y});         }       }       cout << v.size() <<   n ;       for (long long i = 0; i < (long long)v.size(); i++) {         cout << v[i].first <<     << v[i].second <<   n ;       }     }   }   