The sequence of $m$ integers is called the permutation if it contains all integers from $1$ to $m$ exactly once. The number $m$ is called the length of the permutation.

Dreamoon has two permutations $p_1$ and $p_2$ of non-zero lengths $l_1$ and $l_2$.

Now Dreamoon concatenates these two permutations into another sequence $a$ of length $l_1 + l_2$. First $l_1$ elements of $a$ is the permutation $p_1$ and next $l_2$ elements of $a$ is the permutation $p_2$. 

You are given the sequence $a$, and you need to find two permutations $p_1$ and $p_2$. If there are several possible ways to restore them, you should find all of them. (Note that it is also possible that there will be no ways.)


-----Input-----

The first line contains an integer $t$ ($1 \le t \le 10\,000$) denoting the number of test cases in the input.

Each test case contains two lines. The first line contains one integer $n$ ($2 \leq n \leq 200\,000$): the length of $a$. The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq n-1$).

The total sum of $n$ is less than $200\,000$.


-----Output-----

For each test case, the first line of output should contain one integer $k$: the number of ways to divide $a$ into permutations $p_1$ and $p_2$.

Each of the next $k$ lines should contain two integers $l_1$ and $l_2$ ($1 \leq l_1, l_2 \leq n, l_1 + l_2 = n$), denoting, that it is possible to divide $a$ into two permutations of length $l_1$ and $l_2$ ($p_1$ is the first $l_1$ elements of $a$, and $p_2$ is the last $l_2$ elements of $a$). You can print solutions in any order.


-----Example-----
Input
6
5
1 4 3 2 1
6
2 4 1 3 2 1
4
2 1 1 3
4
1 3 3 1
12
2 1 3 4 5 6 7 8 9 1 10 2
3
1 1 1

Output
2
1 4
4 1
1
4 2
0
0
1
2 10
0



-----Note-----

In the first example, two possible ways to divide $a$ into permutations are $\{1\} + \{4, 3, 2, 1\}$ and $\{1,4,3,2\} + \{1\}$.

In the second example, the only way to divide $a$ into permutations is $\{2,4,1,3\} + \{2,1\}$.

In the third example, there are no possible ways.

Difficulty: MEDIUM

Solutions:
t = int(input())
for i in range(t):
	n = int(input())
	mass = [int(x) for x in input().split()]
	answer = 0
	q = []
	Max = 0
	ind = 0
	for j in range(n):
		if Max < mass[j]:
			Max = mass[j]
	ind = Max - 1
	a1 = mass[:n - ind - 1]
	a2 = mass[n - ind - 1:]
	a3 = mass[:ind + 1]
	a4 = mass[ind + 1:]
	a1.sort()
	a2.sort()
	a3.sort()
	a4.sort()
	f1 = True
	f2 = True
	for i in range(n - ind - 1):
		if a1[i] != i + 1:
			f1 = False
	if f1:
		for i in range(ind + 1):
			if a2[i] != i + 1:
				f1 = False
	if f1:
		answer += 1
		q.append((n - ind - 1, ind + 1))
	for i in range(ind + 1):
		if a3[i] != i + 1:
			f2 = False
	if f2:
		for i in range(n - ind - 1):
			if a4[i] != i + 1:
				f2 = False
	if f2 and n - ind - 1 != ind + 1:
		answer += 1
		q.append((ind + 1, n - ind - 1))
	print(answer)
	for l in q:
		print(*l)


for t in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	mx = max(ar)
	d = []
	for c in range(2):
		if set(ar[:mx]) == set(range(1, mx + 1)) and set(ar[mx:]) == set(range(1, n - mx + 1)):
			d.append(mx)
		mx = n - mx
	p = set(d)
	print(len(p))
	for x in p:
		print(x, n - x)


def possible(a):
	ans = set()
	s = set()
	lmax = 0
	for i in range(len(a)):
		lmax = max(lmax, a[i])
		s.add(a[i])
		if lmax == i + 1 and len(s) == i + 1:
			ans.add(i + 1)
	return ans
t = int(input())
for case_num in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	left = possible(a)
	a.reverse()
	right = possible(a)
	ans = []
	for l in left:
		if n - l in right:
			ans.append(l)
	print(len(ans))
	for l in ans:
		print(l, n - l)


for case in range(int(input())):
	n = int(input())
	series = [int(x) for x in input().split()]
	no_of_ways = 0
	set_a = set()
	set_b = set(series)
	letter_freq = {}
	for l in series:
		try:
			letter_freq[l] += 1
		except KeyError:
			letter_freq[l] = 1
	answers = []
	indices_to_end_a = set()
	visited = {}
	curr_max = -1
	for i in range(1, n + 1):
		num = series[i - 1]
		if num in visited:
			break
		visited[num] = True
		curr_max = max(curr_max, num)
		if curr_max == i:
			indices_to_end_a.add(i)
	visited = {}
	curr_max = -1
	series2 = series[::-1]
	indices_to_end_b = set()
	for i in range(1, n + 1):
		num = series2[i - 1]
		if num in visited:
			break
		visited[num] = True
		curr_max = max(curr_max, num)
		if curr_max == i:
			indices_to_end_b.add(n - i)
	for i in indices_to_end_a:
		if i in indices_to_end_b:
			answers.append([i, n - i])
	print(len(answers))
	for a in answers:
		print(a[0], a[1])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	l = max(a)
	y = {}
	u = 0
	for i in a:
		if i in y:
			y[i] += 1
		else:
			y[i] = 1
		if y[i] >= 3:
			u += 1
			break
	if u == 1:
		print(0)
		continue
	z = 0
	b = set()
	x = 0
	for i in range(l):
		if a[i] in b:
			x += 1
		else:
			b.add(a[i])
	c = a[l:]
	c.sort()
	for i in range(n - l):
		if c[i] != i + 1:
			x = x + 1
	if x == 0:
		z += 1
		p = l
		q = n - l
	u = 0
	b = set()
	x = 0
	for i in range(n - 1, n - l - 1, -1):
		if a[i] in b:
			x += 1
		else:
			b.add(a[i])
	c = a[:n - l]
	c.sort()
	for i in range(n - l):
		if c[i] != i + 1:
			x = x + 1
	if x == 0:
		u += 1
		z += 1
		r = n - l
		s = l
	if z == 0:
		print(0)
	elif z == 1:
		print(1)
		if u == 1:
			print(r, s)
		else:
			print(p, q)
	elif p == q:
		print(1)
		print(r, s)
	else:
		print(2)
		print(r, s)
		print(p, q)


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	summ_all = sum(nums)
	counter = 0
	variants = []
	nums_index = [-1] * n
	L = 0
	R = n - 1
	for j in range(n):
		if nums_index[nums[j] - 1] != -1:
			L = max(L, nums_index[nums[j] - 1] + 1)
			R = min(R, j)
		nums_index[nums[j] - 1] = j
	if L > R:
		ans.append([0])
	else:
		sum1 = sum(nums[:L])
		for j in range(L, R + 1):
			if sum1 == (j + 1) * j // 2 and summ_all - sum1 == (n - j) * (n - j + 1) // 2:
				variants.append(str(j) + ' ' + str(n - j))
				counter += 1
			sum1 += nums[j]
		ans.append([counter, variants])
for i in ans:
	print(i[0])
	if i[0] != 0:
		for j in range(i[0]):
			print(i[1][j])


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	(cnt, l, r, t) = ([0] * n, [0] * n, [0] * n, 0)
	for i in range(n):
		cnt[a[i]] += 1
		if cnt[a[i]] > 1:
			break
		t = max(t, a[i])
		if t == i + 1:
			l[i] = 1
	(cnt, t) = ([0] * n, 0)
	for i in range(n - 1, -1, -1):
		cnt[a[i]] += 1
		if cnt[a[i]] > 1:
			break
		t = max(t, a[i])
		if t == n - i:
			r[i] = 1
	res = []
	for i in range(n - 1):
		if l[i] + r[i + 1] == 2:
			res.append((i + 1, n - i - 1))
	print(len(res))
	for x in res:
		print(*x)


from collections import Counter
q = int(input())
for _ in range(q):
	n = int(input())
	dat = list(map(int, input().split()))
	c = Counter(dat)
	m = 0
	realmax = max(dat)
	f = True
	mode = 2
	maxval = -1
	for i in range(1, realmax + 1):
		if i not in c:
			f = False
			break
		if c[i] == 2:
			maxval = i
			continue
		if c[i] != 1:
			f = False
			break
	if n != maxval + realmax or f is False:
		print('0')
	else:
		lmax = dat[:maxval]
		rmax = dat[-maxval:]
		lreal = dat[:realmax]
		rreal = dat[-realmax:]
		lmax.sort()
		rmax.sort()
		lreal.sort()
		rreal.sort()
		ansm = list(range(1, maxval + 1))
		ansr = list(range(1, realmax + 1))
		res = []
		if lmax == ansm and rreal == ansr:
			res.append('{0} {1}'.format(maxval, realmax))
		if lreal == ansr and rmax == ansm:
			res.append('{0} {1}'.format(realmax, maxval))
		if len(res) == 2:
			if res[0] == res[1]:
				res = [res[0]]
		print(len(res))
		if len(res) > 0:
			print('\n'.join(res))


import sys
r = int(input())
t = -1

def input():
	global t
	t += 1
	return data[t]
data = sys.stdin.readlines()
for _ in range(r):
	k = int(input())
	a = list(map(int, input().split()))
	m = 0
	s = set()
	left = [False] * k
	for i in range(k):
		s.add(a[i])
		m = max(a[i], m)
		if m == len(s) == i + 1:
			left[i] = True
	m = 0
	s = set()
	right = [False] * k
	for i in range(k - 1, -1, -1):
		s.add(a[i])
		m = max(a[i], m)
		if m == len(s) == k - i:
			right[i] = True
	count = 0
	answer = []
	for i in range(k - 1):
		if left[i] and right[i + 1]:
			count += 1
			answer.append((i + 1, k - i - 1))
	print(count)
	for i in answer:
		print(*i)


from collections import defaultdict

def solve():
	N = int(input())
	arr = list(map(int, input().split()))
	splits = []
	l_dict = defaultdict(lambda : 0)
	l_dict_sum = 0
	r_dict = defaultdict(lambda : 0)
	for item in arr:
		r_dict[item] += 1
	r_dict_sum = sum(r_dict.keys())
	for i in range(N):
		left_len = i + 1
		right_len = N - (i + 1)
		l_e_s = left_len * (left_len + 1) // 2
		r_e_s = right_len * (right_len + 1) // 2
		r_dict[arr[i]] -= 1
		if r_dict[arr[i]] == 0:
			del r_dict[arr[i]]
			r_dict_sum -= arr[i]
		l_dict[arr[i]] += 1
		if l_dict[arr[i]] == 1:
			l_dict_sum += arr[i]
		if l_dict_sum == l_e_s and len(l_dict) == left_len and (r_dict_sum == r_e_s) and (len(r_dict) == right_len):
			splits.append((left_len, right_len))
	print(len(splits))
	for (l, r) in splits:
		print('{} {}'.format(l, r))
T = int(input())
for t in range(T):
	solve()


I = input
for _ in [0] * int(I()):
	n = int(I())
	a = (*map(int, I().split()),)
	m = max(a)
	r = [(k, n - k) for k in {m, n - m} if sorted(a[:k]) + sorted(a[k:]) == [*range(1, k + 1), *range(1, n - k + 1)]]
	print(len(r))
	for x in r:
		print(*x)


t = int(input())
for _ in range(t):
	n = int(input())
	r = 0
	a = list(map(int, input().split()))
	if n <= 2 * max(a):
		maxx = max(a)
		b = [0] * maxx
		for i in range(n):
			b[a[i] - 1] += 1
		flag = 1
		for i in range(0, maxx - 1):
			if b[i] == 1 and b[i + 1] == 1:
				pass
			elif b[i] == 2 and b[i + 1] == 2:
				pass
			elif b[i] == 2 and b[i + 1] == 1:
				r = i + 1
				flag = 2
			else:
				flag = 0
				break
		if flag == 1:
			if b.count(1) == n:
				flag = 0
			elif b.count(2) == n // 2:
				r = n // 2
	else:
		flag = 0
	if flag == 0:
		print(0)
	else:
		rr = []
		aa = [i + 1 for i in range(r)]
		if sorted(a[0:r]) == aa:
			rr.append([r, n - r])
		if flag != 1:
			if sorted(a[n - r:n]) == aa:
				rr.append([n - r, r])
		print(len(rr))
		if len(rr) > 0:
			for x in rr:
				print(*x)


import heapq
for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	LeftHalf = [False] * n
	rightHalf = [False] * n
	Highestelement = 0
	Sum = 0
	d = {}
	ans = 0
	for i in range(n):
		if array[i] > Highestelement:
			Highestelement = array[i]
		Sum += array[i]
		if array[i] in d:
			break
		else:
			d[array[i]] = 0
		if Sum == (i + 1) * (i + 2) // 2 and Highestelement == i + 1:
			LeftHalf[i] = True
	Highestelement = 0
	Sum = 0
	d = {}
	for i in range(n - 1, -1, -1):
		if array[i] > Highestelement:
			Highestelement = array[i]
		Sum += array[i]
		if array[i] in d:
			break
		else:
			d[array[i]] = 0
		if Sum == (n - i) * (n - i + 1) // 2 and Highestelement == n - i:
			rightHalf[i] = True
	ansArray = []
	for i in range(n - 1):
		if LeftHalf[i] and rightHalf[i + 1]:
			ans += 1
			ansArray.append([i + 1, n - (i + 1)])
	print(ans)
	for i in ansArray:
		print(*i)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = set()
	m = 0
	ans = set()
	for i in range(n):
		if a[i] > m and a[i] in s:
			m = a[i]
		s.add(a[i])
	if sorted(a[:m]) == list(range(1, m + 1)) and sorted(a[m:]) == list(range(1, n - m + 1)):
		ans.add(m)
	if sorted(a[:n - m]) == list(range(1, n - m + 1)) and sorted(a[n - m:]) == list(range(1, m + 1)):
		ans.add(n - m)
	print(len(ans))
	for i in ans:
		print(i, n - i)


t = int(input())
while t != 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	p = max(list1)
	p1 = set(list1[:p])
	ans = list()
	if p1 == set(range(1, p + 1)):
		q1 = set(list1[p:])
		if q1 == set(range(1, n - p + 1)):
			ans.append(p)
	p2 = set(list1[:n - p])
	if p2 == set(range(1, n - p + 1)):
		q2 = set(list1[n - p:])
		if q2 == set(range(1, p + 1)):
			ans.append(n - p)
	ans = set(ans)
	print(len(ans))
	for i in ans:
		print(i, n - i)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k = [0] * n
	f = False
	p = 1
	r = 0
	for i in range(n):
		k[a[i] - 1] += 1
	if k[0] != 2:
		f = True
	else:
		for i in range(1, n):
			if k[i] > k[i - 1]:
				f = True
			if k[i] == 2:
				p += 1
			if k[i] == 1:
				r += 1
	c = 0
	b = []
	maxi = -1
	used = [0] * n
	for i in range(n - 1):
		if used[a[i] - 1] != 0:
			break
		used[a[i] - 1] = 1
		if k[i] == 2:
			p -= 1
		if k[i] == 1:
			r -= 1
		if a[i] > maxi:
			maxi = a[i]
		if maxi == i + 1:
			if n - i - 1 > i:
				if k[i] == 2 and p == 0:
					c += 1
					b.append(i + 1)
			elif k[n - i - 2] == 2 and p == 0:
				c += 1
				b.append(i + 1)
	if f:
		print(0)
	else:
		print(c)
		for i in b:
			print(i, n - i)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	v = [0] * n
	i = 1
	s = 0
	r = 1
	r1 = 1
	for x in a:
		v[x] += 1
	if v[1] <= 1:
		print(0)
	elif n == 2:
		if a[0] == 1 and a[1] == 1:
			print(1)
			print('1 1')
		else:
			print(0)
	else:
		while v[i] >= 2:
			s += 1
			i += 1
		b = sorted(a[0:s])
		e = sorted(a[s:])
		b1 = sorted(a[n - s:])
		e1 = sorted(a[0:n - s])
		for i in range(len(b)):
			if b[i] != i + 1:
				r = 0
				break
		for i in range(len(e)):
			if e[i] != i + 1:
				r = 0
				break
		for i in range(len(b1)):
			if b1[i] != i + 1:
				r1 = 0
				break
		for i in range(len(e1)):
			if e1[i] != i + 1:
				r1 = 0
				break
		if r == 0 and r1 == 0:
			print(0)
		elif r == 1 and r1 == 1:
			if len(b) != len(e):
				print(2)
				print(len(b), len(e))
				print(len(e1), len(b1))
			else:
				print(1)
				print(len(b), len(e))
		elif r == 1:
			print(1)
			print(len(b), len(e))
		else:
			print(1)
			print(len(e1), len(b1))


t = int(input())
for _ in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	(check, yes1, yes2) = ([0] * (n + 1), [0] * (n + 1), [0] * (n + 1))
	(ans, ma) = (0, 0)
	ans2 = []
	for i in range(n):
		if check[x[i]] == 1:
			break
		else:
			ma = max(ma, x[i])
			if i == ma - 1:
				yes1[i] = 1
			check[x[i]] = 1
	(check, ma) = ([0] * (n + 1), 0)
	for i in range(n - 1, -1, -1):
		if check[x[i]] == 1:
			break
		else:
			ma = max(ma, x[i])
			if n - i == ma:
				yes2[i] = 1
			check[x[i]] = 1
	for i in range(n - 1):
		if yes1[i] == 1 and yes2[i + 1] == 1:
			ans += 1
			ans2.append(i + 1)
	print(ans)
	for i in range(ans):
		print(ans2[i], n - ans2[i])


def sol(p):
	arr = sorted(p)
	for i in range(len(arr)):
		if arr[i] != i + 1:
			return False
	return True
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mx = max(a)
	res = []
	(p1, p2) = (a[0:n - mx], a[n - mx:n])
	if sol(p1) and sol(p2):
		res.append(n - mx)
	(p1, p2) = (a[0:mx], a[mx:n])
	if sol(p1) and sol(p2):
		res.append(mx)
	res = set(res)
	print(len(res))
	for a in res:
		print(a, n - a)


import math

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = [int(i) for i in input().split()]
		counters = {}
		repeated = set()
		for el in arr:
			if el not in counters:
				counters[el] = 1
			else:
				counters[el] += 1
				repeated.add(el)
		reverse_max = list(arr)
		for i in range(n - 2, -1, -1):
			reverse_max[i] = max(reverse_max[i], reverse_max[i + 1])
		current = set()
		big = -math.inf
		answer = []
		for index in range(n - 1):
			el = arr[index]
			if el in current:
				break
			current.add(el)
			counters[el] -= 1
			if counters[el] == 1 and el in repeated:
				repeated.remove(el)
			big = max(big, el)
			if big != len(current):
				continue
			if len(repeated) != 0 or reverse_max[index + 1] != n - index - 1:
				continue
			answer.append((index + 1, n - index - 1))
		print(len(answer))
		for part in answer:
			print(*part)
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	k = int(input())
	a = list(map(int, input().split()))
	a_c = [0] * (max(a) + 1)
	for i in range(k):
		a_c[a[i]] += 1
	if a_c[1] != 2:
		print(0)
		continue
	flag = True
	u = int(100000000.0)
	for i in range(2, len(a_c)):
		if a_c[i] == 2 and a_c[i - 1] >= a_c[i]:
			pass
		elif a_c[i] == 1 and a_c[i - 1] >= a_c[i]:
			u = min(u, i)
		else:
			flag = False
	if not flag:
		print(0)
		continue
	elif a_c[-1] == 2:
		if len(a_c) - 1 == len(set(a[0:len(a_c) - 1])):
			print(1)
			print(len(a_c) - 1, len(a_c) - 1)
		else:
			print(0)
	else:
		ans_l = []
		if u - 1 == max(a[0:u - 1]) and len(set(a[0:u - 1])) == u - 1:
			ans_l.append([u - 1, k - u + 1])
		if u - 1 == max(a[k - u + 1:]) and len(set(a[k - u + 1:])) == u - 1:
			ans_l.append([k - u + 1, u - 1])
		print(len(ans_l))
		for i in range(len(ans_l)):
			print(*ans_l[i])


testCases = int(input())
for _ in range(testCases):
	n = int(input())
	a = list(map(int, input().split()))
	mx = max(a)
	mx_ = n - mx
	range1 = set(range(1, mx + 1))
	range2 = set(range(1, mx_ + 1))
	d = set()
	if set(a[:mx]) == range1 and set(a[mx:]) == range2:
		d.add(mx)
	if set(a[:mx_]) == range2 and set(a[mx_:]) == range1:
		d.add(mx_)
	print(len(d))
	for x in d:
		print(x, n - x)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	st = []
	vis1 = [0] * n
	vis2 = [0] * n
	while a:
		if vis1[a[-1]] == 0:
			st.append(a.pop())
			vis1[st[-1]] = 1
		else:
			break
	fl = 0
	for i in a:
		if vis2[i] == 0:
			vis2[i] += 1
		else:
			fl = 1
			break
	ans = []
	if sum(vis2) == max(a) and sum(vis1) == max(st) and (fl == 0):
		ans.append([len(a), len(st)])
	a += st[::-1]
	a = a[::-1]
	st = []
	vis1 = [0] * n
	vis2 = [0] * n
	while a:
		if vis1[a[-1]] == 0:
			st.append(a.pop())
			vis1[st[-1]] = 1
		else:
			break
	fl = 0
	for i in a:
		if vis2[i] == 0:
			vis2[i] += 1
		else:
			fl = 1
			break
	if sum(vis2) == max(a) and sum(vis1) == max(st) and (fl == 0) and (not ans or ans[-1] != [len(st), len(a)]):
		ans.append([len(st), len(a)])
	print(len(ans))
	for i in ans:
		print(*i)


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	a = [0] * n
	b = [0] * n
	c = dict()
	d = dict()
	c1 = 0
	c2 = 0
	count = 0
	p = []
	max1 = 0
	max2 = 0
	for i in range(n):
		if l[i] not in c:
			c[l[i]] = 1
			c1 += 1
			if l[i] > max1:
				max1 = l[i]
			if max1 == c1:
				a[i] = 1
		else:
			break
	for i in range(n - 1, -1, -1):
		if l[i] not in d:
			d[l[i]] = 1
			c2 += 1
			if l[i] > max2:
				max2 = l[i]
			if c2 == max2:
				b[i] = 1
		else:
			break
	for i in range(n - 1):
		if a[i] == 1 and b[i + 1] == 1:
			count += 1
			p.append([i + 1, n - i - 1])
	print(count)
	for i in p:
		print(*i)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	occur1 = set()
	pos1 = set()
	max1 = 0
	for i in range(n):
		if a[i] in occur1:
			break
		occur1.add(a[i])
		max1 = max(max1, a[i])
		if len(occur1) == max1:
			pos1.add(i)
	occur2 = set()
	pos2 = set()
	max2 = 0
	for j in range(n):
		i = n - j - 1
		if a[i] in occur2:
			break
		occur2.add(a[i])
		max2 = max(max2, a[i])
		if len(occur2) == max2:
			pos2.add(i - 1)
	ans = 0
	pointer = []
	for i in pos1:
		if i in pos2:
			ans += 1
			pointer.append(i)
	print(ans)
	for i in pointer:
		print(i + 1, n - i - 1)


tc = int(input())
for _ in range(int(tc)):
	n = int(input())
	a = list(map(int, input().split()))
	mx = max(a)
	d = []
	if set(a[:mx]) == set(range(1, mx + 1)) and set(a[mx:n]) == set(range(1, n - mx + 1)):
		d.append(mx)
	if set(a[:n - mx]) == set(range(1, n - mx + 1)) and set(a[n - mx:n]) == set(range(1, mx + 1)):
		d.append(n - mx)
	d = set(d)
	print(len(d))
	for i in d:
		print(i, n - i)


import math

def quadratic(a, b, c):
	if a == 0:
		return (int(-c / b), int(-c / b))
	elif b * b - 4 * a * c < 0:
		raise Exception
	elif b * b - 4 * a * c == 0:
		return (int(-b / (2 * a)), int(-b / (2 * a)))
	else:
		return (int((-b - math.sqrt(b * b - 4 * a * c)) / (2 * a)), int((-b + math.sqrt(b * b - 4 * a * c)) / (2 * a)))

def check(arr):
	arr.sort()
	for (i, val) in enumerate(arr):
		if i == val - 1:
			continue
		else:
			return False
	return True
t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	a = [int(_) for _ in input().strip().split()]
	try:
		(l1, l2) = quadratic(2, -2 * n, n * n + n - 2 * sum(a))
		if l1 == 0 or l2 == 0 or l1 + l2 != n:
			print(0)
		elif l1 != l2:
			flag0 = check(a[:l1]) and check(a[l1:])
			flag1 = check(a[:l2]) and check(a[l2:])
			if flag0 and flag1:
				print(2)
				print(l1, l2)
				print(l2, l1)
			elif flag0:
				print(1)
				print(l1, l2)
			elif flag1:
				print(1)
				print(l2, l1)
			else:
				print(0)
		else:
			flag0 = check(a[:l1]) and check(a[l1:])
			if flag0:
				print(1)
				print(l1, l1)
			else:
				print(0)
	except Exception as e:
		print(0)


R = lambda : map(int, input().split())
t = int(input())

def check(a):
	n = len(a)
	b = [0] * (n + 1)
	for x in a:
		if x > n or 1 > x:
			return False
		b[x] = 1
	return sum(b) == n

def solve(a, n):
	b = [0] * n
	for x in a:
		b[x] += 1
	if 2 not in b:
		print(0)
		return
	if 1 not in b:
		if n % 2:
			print(0)
			return
		elif b[1:n // 2 + 1] != [2] * (n // 2):
			print(0)
			return
		else:
			z1 = check(a[:n // 2])
			z2 = check(a[n // 2:])
			print(int(z1 and z2))
			if z1 and z2:
				print(n // 2, n // 2)
			return
	first = b.index(1)
	if first < 2:
		print(0)
		return
	if b[1:first] != [2] * (first - 1) or b[first:n - first + 2] != [1] * (n - 2 * first + 2):
		print(0)
		return
	z1 = check(a[:first - 1]) and check(a[first - 1:])
	z2 = check(a[1 - first:]) and check(a[1 - first:])
	print(int(z1) + int(z2))
	if z1:
		print(first - 1, n - first + 1)
	if z2:
		print(n - first + 1, first - 1)
for _ in range(t):
	n = int(input())
	a = list(R())
	solve(a, n)


for _ in [0] * int(input()):
	a = int(input())
	b = list(map(int, input().split()))
	z = max(b)
	d = []
	for i in range(2):
		if set(b[:z]) == set(range(1, z + 1)) and set(b[z:]) == set(range(1, a - z + 1)):
			d.append(z)
		z = a - z
	d = set(d)
	print(len(d))
	for i in d:
		print(i, a - i)


def check(l, i, j):
	r = [0] * (j - i + 1)
	try:
		for x in range(j - i + 1):
			if r[l[x + i] - 1] == 0:
				r[l[x + i] - 1] = l[x + i]
			else:
				return False
	except:
		return False
	return True

def sol(l):
	M = max(l)
	m = len(l) - M
	r = 0
	if check(l, 0, m - 1) and check(l, m, len(l) - 1):
		r += 1
	if check(l, 0, M - 1) and check(l, M, len(l) - 1):
		r += 2
	if r == 0:
		print(0)
	elif r == 1:
		print(1)
		print(m, M)
	elif r == 2:
		print(1)
		print(M, m)
	elif r == 3:
		if m != M:
			print(2)
			print(m, M)
			print(M, m)
		else:
			print(1)
			print(m, M)
t = int(input())
for _ in range(t):
	length = int(input())
	l = list(map(int, input().split()))
	sol(l)


import sys
read = sys.stdin.buffer.readline
for _ in range(int(read())):
	n = int(read())
	a = list(map(int, read().split()))
	ans = set()
	mx = max(a)
	for i in range(2):
		if set(a[:mx]) == set(range(1, mx + 1)) and set(a[mx:]) == set(range(1, n - mx + 1)):
			ans.add(mx)
		mx = n - mx
	print(len(ans))
	for i in ans:
		print(i, n - i)


I = input
pr = print

def main():
	for _ in range(int(I())):
		n = int(I())
		ar = list(map(int, I().split()))
		i = max(ar)
		d = []
		for c in range(2):
			if set(ar[:i]) == set(range(1, i + 1)) and set(ar[i:]) == set(range(1, n - i + 1)):
				d.append(i)
			i = n - i
		d = set(d)
		pr(len(d))
		for x in d:
			pr(x, n - x)
main()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	n = int(inp())
	a = lis()
	left = {}
	right = {}
	curr = set()
	mx = 0
	for i in range(n):
		prev = len(curr)
		curr.add(a[i])
		mx = max(mx, a[i])
		if len(curr) == i + 1 and mx == i + 1:
			left[i] = True
		if prev == len(curr):
			break
	curr = set()
	mx = 0
	for i in range(n - 1, -1, -1):
		prev = len(curr)
		curr.add(a[i])
		mx = max(mx, a[i])
		if len(curr) == n - i and mx == n - i:
			right[i] = True
		if prev == len(curr):
			break
	ans = []
	for i in left:
		if i + 1 in right:
			ans.append([i + 1, n - (i + 1)])
	print(len(ans))
	for i in range(len(ans)):
		print(*ans[i])
testcase(int(inp()))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = []

	def find(a):
		seen = set()
		(mx, mn) = (1, 3 * 10 ** 5)
		ans = []
		for i in range(len(a)):
			mx = max(mx, a[i])
			mn = min(mn, a[i])
			seen.add(a[i])
			if mn == 1 and mn + i == mx and (len(seen) == i + 1):
				ans.append(True)
			else:
				ans.append(False)
		return ans
	ans1 = find(a)
	ans2 = find(a[::-1])
	ans2 = ans2[::-1]
	for i in range(n - 1):
		if ans1[i] and ans2[i + 1]:
			ans.append([i + 1, n - (i + 1)])
	print(len(ans))
	for ent in ans:
		print(*ent)


from collections import deque
t = int(input())
for _ in range(t):
	n = int(input())
	liste = list(map(int, input().split()))
	vis = [0 for i in range(n)]
	can = [0 for i in range(n)]
	can2 = [0 for i in range(n)]
	maxi = 0
	for i in range(1, n):
		if vis[liste[i - 1]]:
			break
		vis[liste[i - 1]] = 1
		maxi = max(maxi, liste[i - 1])
		if maxi == i:
			can[maxi] = 1
	liste = liste[::-1]
	maxi = 0
	vis = [0 for i in range(n)]
	for i in range(1, n):
		if vis[liste[i - 1]]:
			break
		vis[liste[i - 1]] = 1
		maxi = max(maxi, liste[i - 1])
		if maxi == i:
			can2[maxi] = 1
	count = 0
	for i in range(1, n):
		if can[i] and can2[n - i]:
			count += 1
	print(count)
	for i in range(1, n):
		if can[i] and can2[n - i]:
			print(i, n - i)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	n = I()
	a = li()
	d = defaultdict(int)
	pre = [0] * n
	c = 1
	ans = []
	k = 0
	for i in range(n):
		if a[i] == c:
			pre[i] = 1
			d[a[i]] = 1
			while c in d:
				c += 1
			if c - 1 == i + 1:
				ans.append(i + 1)
				k = i
		else:
			d[a[i]] == 1
	b = a.copy()
	req = ans.copy()
	a = a[::-1]
	d = defaultdict(int)
	pre = [0] * n
	c = 1
	ans = []
	k = 0
	for i in range(n):
		if a[i] == c:
			pre[i] = 1
			d[a[i]] = 1
			while c in d:
				c += 1
			if c - 1 == i + 1:
				ans.append(i + 1)
				k = i
		else:
			d[a[i]] == 1
	i = 0
	j = 0
	pink = []
	c = Counter(req)
	d = Counter(ans)
	for i in c:
		if n - i in d:
			pink.append([i, n - i])
	print(len(pink))
	for i in pink:
		print(*i)
for _ in range(int(input())):
	case()


import sys
import bisect
from collections import deque
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(int(ri())):
	n = int(ri())
	a = RI()
	dic = {}
	cnt = 0
	maxx = -1
	lis = []
	bool1 = [False] * n
	bool2 = [False] * n
	for i in range(len(a)):
		if a[i] not in dic:
			dic[a[i]] = 1
			if maxx == -1:
				maxx = a[i]
				cnt += 1
			elif a[i] < maxx:
				cnt += 1
			else:
				maxx = a[i]
				cnt += 1
		else:
			break
		if maxx == cnt:
			bool1[i] = True
			lis.append(i)
	dic = {}
	cnt = 0
	maxx = -1
	for i in range(len(a) - 1, -1, -1):
		if a[i] not in dic:
			dic[a[i]] = 1
			if maxx == -1:
				maxx = a[i]
				cnt += 1
			elif a[i] < maxx:
				cnt += 1
			else:
				maxx = a[i]
				cnt += 1
		else:
			break
		if maxx == cnt:
			bool2[i] = True
	ans = []
	for i in range(n - 1):
		if bool1[i] and bool2[i + 1]:
			ans.append([i + 1, n - (i + 1)])
	print(len(ans))
	for i in ans:
		print(*i)


import sys
import collections
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		N = int(input())
		A = [int(x) for x in input().split()]
		before = [0] * (N + 1)
		beforeset = set()
		ma = 0
		f = False
		for (i, a) in enumerate(A):
			if a == 1:
				f = True
			ma = max(a, ma)
			beforeset.add(a)
			if ma == i + 1 and f and (len(beforeset) == i + 1):
				before[i + 1] = 1
		after = [0] * (N + 1)
		afterset = set()
		ma = 0
		f = False
		for (i, a) in enumerate(A[::-1]):
			if a == 1:
				f = True
			ma = max(a, ma)
			afterset.add(a)
			if ma == i + 1 and f and (len(afterset) == i + 1):
				after[N - i] = 1
		ans = 0
		lans = []
		for i in range(1, N):
			if before[i] == 1 and after[i + 1] == 1:
				ans += 1
				lans.append([i, N - i])
		if ans == 0:
			print(0)
		else:
			print(ans)
			for a in lans:
				print(*a)
main()


def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		(x1, x2, k) = (sum(a), 0, 0)
		l = []
		s1 = set()
		s2 = set(a)
		for i in range(n):
			if x1 - a[i] == (n - i - 1) * (n - i) // 2 and x2 + a[i] == (i + 1) * (i + 2) // 2 and (i != n - 1) and (set(a[:i + 1]).__len__() == i + 1) and (set(a[i + 1:]).__len__() == n - i - 1):
				l.append([i + 1, n - i - 1])
				k += 1
			x1 -= a[i]
			x2 += a[i]
		print(k)
		for i in range(k):
			print(l[i][0], l[i][1])
main()


def n_perm(arr, n):
	temp = [0] * (n + 1)
	for i in range(n):
		if arr[i] > n:
			return False
		if temp[arr[i]] == 1:
			return False
		temp[arr[i]] = 1
	return True

def help():
	n = int(input())
	arr = list(map(int, input().split(' ')))
	arr1 = [0] * n
	done = 0
	i = 0
	for i in range(n):
		if arr[i] >= n:
			print(0)
			return
		arr1[arr[i]] += 1
	done = 0
	for i in range(n):
		if i > 1 and arr1[i] > arr1[i - 1]:
			print(0)
			return
		if arr1[i] == 2:
			done += 1
		if arr1[i] > 2:
			print(0)
			return
	ans = 0
	oo = False
	ob = False
	if n_perm(arr[:done], done) and n_perm(arr[done:], n - done):
		oo = True
		ans += 1
	if done == n - done:
		print(ans)
		if oo:
			print(done, n - done)
		return
	if n_perm(arr[:n - done], n - done) and n_perm(arr[n - done:], done):
		ob = True
		ans += 1
	print(ans)
	if oo:
		print(done, n - done)
	if ob:
		print(n - done, done)
for qw in range(int(input())):
	help()


def solve(arr):
	ans = []
	ans_left = [False for i in range(len(arr))]
	ans_right = [False for i in range(len(arr))]
	totalSum = sum(arr)
	partial_sum = 0
	isPresent = [0 for i in range(0, len(arr) + 1)]
	for i in range(1, len(arr) + 1):
		if arr[i - 1] < len(isPresent) and isPresent[arr[i - 1]] == 1:
			break
		else:
			isPresent[arr[i - 1]] = 1
		partial_sum += arr[i - 1]
		if partial_sum == i * (i + 1) // 2:
			ans_left[i - 1] = True
	partial_sum = 0
	isPresent = [0 for i in range(0, len(arr) + 1)]
	for i in range(1, len(arr) + 1):
		ind = len(arr) - i
		if arr[ind] < len(isPresent) and isPresent[arr[ind]] == 1:
			break
		else:
			isPresent[arr[ind]] = 1
		partial_sum += arr[ind]
		if partial_sum == i * (i + 1) // 2:
			ans_right[ind] = True
	if ans_right[0] == True:
		ans.append([0, len(arr)])
		ans.append([0, len(arr)])
	for i in range(0, len(arr) - 1):
		if ans_left[i] == True and ans_right[i + 1] == True:
			ans.append([i + 1, len(arr) - i - 1])
	print(len(ans))
	for lt in ans:
		print(' '.join(list(map(lambda x: str(x), lt))))
t = int(input())
for i in range(0, t):
	input()
	arr = list(map(lambda x: int(x), input().split()))
	solve(arr)


from collections import Counter, defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	ls = list(map(int, input().strip().split()))
	freq_dic = Counter(ls)
	poss_ans = []
	maxi = 0
	f = 0
	for (key, val) in freq_dic.items():
		if val == 3:
			f = 3
			break
		if val == 2:
			if key > maxi:
				maxi = key
	if f == 3:
		print('0')
	else:
		c = 0
		ans = []
		dic = defaultdict(int)
		if True:
			f1 = Counter(ls[:maxi])
			f2 = Counter(ls[maxi:])
			f = 0
			for i in range(1, maxi + 1):
				if f1[i] != 1:
					f = 1
					break
			if f == 0:
				for i in range(1, n - maxi + 1):
					if f2[i] != 1:
						f = 1
						break
			if f == 0:
				if maxi == n - maxi:
					if (maxi, n - maxi) not in dic:
						c += 1
						dic[maxi, n - maxi] = 1
						ans.append(maxi)
						ans.append(n - maxi)
				else:
					c += 1
					dic[maxi, n - maxi] = 1
					ans.append(maxi)
					ans.append(n - maxi)
			f1 = Counter(ls[:n - maxi])
			f2 = Counter(ls[n - maxi:])
			f = 0
			for i in range(1, n - maxi + 1):
				if f1[i] != 1:
					f = 1
					break
			if f == 0:
				for i in range(1, maxi + 1):
					if f2[i] != 1:
						f = 1
						break
			if f == 0:
				if maxi == n - maxi:
					if (maxi, n - maxi) not in dic:
						c += 1
						dic[n - maxi, maxi] = 1
						ans.append(n - maxi)
						ans.append(maxi)
				else:
					c += 1
					dic[n - maxi, maxi] = 1
					ans.append(n - maxi)
					ans.append(maxi)
		print(c)
		if c > 0:
			for i in range(0, len(ans), 2):
				print(ans[i], ans[i + 1])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	m = max(l)
	s = set(l)
	if m == len(s):
		a1 = l[:n - m]
		a2 = l[n - m:]
		a3 = l[:m]
		a4 = l[m:]
		s1 = set(a1)
		s2 = set(a2)
		s3 = set(a3)
		s4 = set(a4)
		f1 = False
		f2 = False
		if len(s1) == max(a1) and len(s2) == max(a2) and (max(a1) == n - m) and (max(a2) == m):
			f1 = True
		if len(s3) == max(a3) and len(s4) == max(a4) and (max(a3) == m) and (max(a4) == n - m):
			f2 = True
		if f1 == True and f2 == True:
			if n - m != m:
				print(2)
				print(n - m, m)
				print(m, n - m)
			else:
				print(1)
				print(n - m, m)
		elif f1 == True:
			print(1)
			print(n - m, m)
		elif f2 == True:
			print(1)
			print(m, n - m)
		else:
			print(0)
	else:
		print(0)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = max(a)
	r = 1
	r1 = 1
	l = sorted(a[:n - m])
	e = sorted(a[n - m:])
	l1 = sorted(a[:m])
	e1 = sorted(a[m:])
	for i in range(len(l)):
		if l[i] != i + 1:
			r = 0
			break
	for i in range(len(e)):
		if e[i] != i + 1:
			r = 0
			break
	for i in range(len(l1)):
		if l1[i] != i + 1:
			r1 = 0
			break
	for i in range(len(e1)):
		if e1[i] != i + 1:
			r1 = 0
			break
	if r == 0 and r1 == 0:
		print(0)
	elif r == 1 and r1 == 1:
		if n - m == m:
			print(1)
			print(n - m, m)
		else:
			print(2)
			print(n - m, m)
			print(m, n - m)
	elif r == 1:
		print(1)
		print(n - m, m)
	else:
		print(1)
		print(m, n - m)


testCases = int(input())
for _ in range(testCases):
	n = int(input())
	a = list(map(int, input().split()))
	mx = max(a)
	d = set()
	for c in range(2):
		if set(a[:mx]) == set(range(1, mx + 1)) and set(a[mx:]) == set(range(1, n - mx + 1)):
			d.add(mx)
		mx = n - mx
	print(len(d))
	for x in d:
		print(x, n - x)


def find(a):
	n = len(a)
	(minn1, minn2, maxx1, maxx2) = ([10 ** 9], [10 ** 9], [0], [0])
	k = []
	(f1, f2) = ([], [])
	k = {}
	for i in range(n):
		if a[i] not in k:
			k[a[i]] = 'A'
		if len(k) == i + 1:
			f1.append(True)
		else:
			f1.append(False)
		minn1.append(min(minn1[-1], a[i]))
		maxx1.append(max(maxx1[-1], a[i]))
	a = a[::-1]
	kk = {}
	for i in range(n):
		if a[i] not in kk:
			kk[a[i]] = 'A'
		if len(kk) == i + 1:
			f2.append(True)
		else:
			f2.append(False)
		minn2.append(min(minn2[-1], a[i]))
		maxx2.append(max(maxx2[-1], a[i]))
	return (minn1[1:], minn2[::-1][1:-1], maxx1[1:], maxx2[::-1][1:-1], f1, f2[::-1][1:])
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	(minf, minb, maxf, maxb, fir, sec) = find(a)
	f = []
	for i in range(n - 1):
		if minf[i] == 1 and maxf[i] == i + 1 and fir[i] and (minb[i] == 1) and (maxb[i] == n - i - 1) and sec[i]:
			f.append([i + 1, n - i - 1])
	if len(f) == 0:
		print(0)
	else:
		print(len(f))
		for x in f:
			print(x[0], x[1])


import sys
import math

def alele():
	return list(map(int, sys.stdin.readline().strip().split()))

def ilele():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
import bisect
INF = 10 ** 18
mod = 10 ** 9 + 7

def check(C):
	C.sort()
	j = 1
	for i in C:
		if i != j:
			return False
		j += 1
	return True
for _ in range(int(input())):
	n = int(input())
	A = alele()
	D = set()
	maxi = 0
	Ans = []
	for i in range(n):
		maxi = max(maxi, A[i])
		D.add(A[i])
		if len(D) == i + 1 and maxi == i + 1:
			if check(A[i + 1:]):
				Ans.append((i + 1, n - i - 1))
	print(len(Ans))
	for (i, j) in Ans:
		print(i, j)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = {}
	for x in a:
		c[x] = c.get(x, 0) + 1
	b = 0
	for x in sorted(c):
		if c[x] == 2:
			if x == b + 1:
				b += 1
			else:
				print(0)
				break
		elif c[x] != 1:
			print(0)
			break
	else:
		if set(c) == set(range(1, n - b + 1)):
			v = set()
			if set(range(1, b + 1)) == set(a[:b]):
				v.add(b)
			if set(range(1, n - b + 1)) == set(a[:n - b]):
				v.add(n - b)
			print(len(v))
			for x in v:
				print(x, n - x)
		else:
			print(0)


import sys
inp = sys.stdin.readline

def input():
	return inp().strip()
flush = sys.stdout.flush

def iin():
	return int(input())

def lin():
	return list(map(int, input().split()))

def main():
	T = iin()
	for _ in range(T):
		n = iin()
		a = lin()
		a1 = []
		mx = 0
		did = set()
		br = 0
		for (j, i) in enumerate(a):
			if br:
				a1.append(0)
			else:
				mx = max(mx, i)
				if i in did:
					a1.append(0)
					br = 1
				else:
					did.add(i)
					if mx == j + 1:
						a1.append(mx)
					else:
						a1.append(0)
		a = a[::-1]
		a2 = []
		mx = 0
		did = set()
		br = 0
		for (j, i) in enumerate(a):
			if br:
				a2.append(0)
			else:
				mx = max(mx, i)
				if i in did:
					a2.append(0)
					br = 1
				else:
					did.add(i)
					if mx == j + 1:
						a2.append(mx)
					else:
						a2.append(0)
		a2 = a2[::-1]
		ans = []
		for i in range(n - 1):
			if a1[i] and a2[i + 1]:
				ans.append([a1[i], a2[i + 1]])
		print(len(ans))
		for (i, j) in ans:
			print(i, j)
main()


def calcPer():
	N = int(input())
	nums = list(map(int, input().split()))
	M = max(nums)
	counts = [0 for i in range(M)]
	rang = [0, N]
	dup_num = 0
	for i in range(N):
		counts[nums[i] - 1] += 1
		n = counts[nums[i] - 1]
		if n > 2:
			print(0)
			return
		if n == 2 and dup_num == 0:
			dup_num = nums[i]
			rang[1] = i
			rang[0] = nums.index(nums[i])
	if 0 in counts:
		print(0)
		return
	for i in range(rang[0] + 1, rang[1]):
		if counts[nums[i] - 1] == 2:
			rang[0] = i
	if rang == [0, N]:
		print(0)
		return
	outs = []
	count_w = 0
	lis1 = nums[0:rang[0] + 1]
	lis2 = nums[rang[0] + 1:N]
	m1 = max(lis1)
	counts = [0 for i in range(m1)]
	for l in lis1:
		counts[l - 1] += 1
	(valid1, valid2) = (1, 1)
	for c in counts:
		if c != 1:
			valid1 = 0
			break
	if valid1:
		m2 = max(lis2)
		counts = [0 for i in range(m2)]
		for l in lis2:
			counts[l - 1] += 1
		for c in counts:
			if c != 1:
				valid2 = 0
				break
	if valid1 and valid2:
		count_w += 1
		x = len(lis1)
		outs.append([x, N - x])
	if rang[1] - rang[0] > 1:
		lis1 = nums[0:rang[1]]
		lis2 = nums[rang[1]:N]
		m1 = max(lis1)
		counts = [0 for i in range(m1)]
		for l in lis1:
			counts[l - 1] += 1
		(valid1, valid2) = (1, 1)
		for c in counts:
			if c != 1:
				valid1 = 0
				break
		if valid1:
			m2 = max(lis2)
			counts = [0 for i in range(m2)]
			for l in lis2:
				counts[l - 1] += 1
			for c in counts:
				if c != 1:
					valid2 = 0
					break
		if valid1 and valid2:
			count_w += 1
			x = len(lis1)
			outs.append([x, N - x])
	print(count_w)
	for x in outs:
		print(x[0], x[1])
T = int(input())
for t in range(T):
	calcPer()


t = int(input())
for case in range(t):
	n = int(input())
	al = [int(a) for a in input().split()]
	aset = set()
	bset = set()
	amax = 0
	bmax = 0
	for i in range(n):
		if al[n - i - 1] not in bset:
			bset.add(al[n - i - 1])
			while bmax + 1 in bset:
				bmax += 1
		else:
			break
	for i in range(n - len(bset)):
		if al[i] not in aset:
			aset.add(al[i])
			while amax + 1 in aset:
				amax += 1
		else:
			break
	if len(aset) + len(bset) != n:
		print(0)
		continue
	pairs = []
	if amax + bmax == n:
		pairs.append((amax, bmax))
	for i in range(len(aset), n - 1):
		if al[i] in aset:
			break
		aset.add(al[i])
		while amax + 1 in aset:
			amax += 1
		bset.remove(al[i])
		bmax = min(bmax, al[i] - 1)
		if amax + bmax == n:
			pairs.append((amax, bmax))
	print(len(pairs))
	for p in pairs:
		print('{} {}'.format(p[0], p[1]))


def chk(s, e):
	global a
	oc = [0 for i in range(e - s + 1)]
	for i in a[s:e + 1]:
		if i > e - s + 1:
			return False
		oc[i - 1] = 1
	if 0 in oc:
		return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	oc = [0 for i in range(n - 1)]
	for i in a:
		oc[i - 1] += 1
	if oc[0] != 2:
		print(0)
		continue
	for i in range(len(oc)):
		if oc[i] != 2:
			break
		min_ind = i
	num = 0
	ans = []
	if chk(0, min_ind) and chk(min_ind + 1, n - 1):
		ans.append([min_ind + 1, n - min_ind - 1])
		num += 1
	if chk(0, n - min_ind - 2) and chk(n - min_ind - 1, n - 1):
		ans.append([n - min_ind - 1, min_ind + 1])
		num += 1
	if num == 0:
		print(0)
	elif num == 2 and ans[0][0] == ans[1][0]:
		print(1)
		print(*ans[0])
		continue
	else:
		print(num)
		for i in ans:
			print(*i)


from sys import *
from collections import *
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * n
	c = [0] * n
	d = defaultdict(lambda : 0)
	mx = 0
	for i in range(n):
		if d[a[i]] == 1:
			break
		else:
			d[a[i]] += 1
		mx = max(mx, a[i])
		if mx == i + 1:
			b[i] = 1
	d = defaultdict(lambda : 0)
	mx = 0
	for i in range(n - 1, -1, -1):
		if d[a[i]] == 1:
			break
		else:
			d[a[i]] += 1
		mx = max(mx, a[i])
		if mx == n - i:
			c[i] = 2
	tp = []
	cn = 0
	for i in range(n - 1):
		if b[i] == 1 and c[i + 1] == 2:
			cn += 1
			tp.append((i + 1, n - (i + 1)))
	print(cn)
	for i in range(cn):
		print(tp[i][0], tp[i][1])


import math
t = int(input())
while t > 0:
	n = int(input())
	l = [int(s) for s in input().split()]
	d = []
	mx = max(l)
	for i in range(2):
		if set(l[:mx]) == set(range(1, mx + 1)) and set(range(1, n - mx + 1)) == set(l[mx:]):
			d.append(mx)
		mx = n - mx
	d = set(d)
	print(len(d))
	for i in d:
		print(i, n - i)
	t -= 1


from collections import Counter

def check(list1, list2):
	return set(list1) == set(list2)

def solve(n, a):
	if n == 2:
		if a.count(1) == 2:
			return '1' + '\n' + ' '.join(['1', '1'])
		else:
			return '0'
	counter_a = Counter(a)
	for i in range(1, n):
		if counter_a[i] > 1:
			i += 1
		elif i == 1:
			return '0'
		else:
			i -= 1
			break
	pm = range(1, i + 1)
	head = a[:i]
	tail = a[-i:]
	check1 = check(head, pm)
	check2 = check(tail, pm)
	if check1 and check2:
		new = a[:-i]
		pm = range(1, len(new) + 1)
		if check(new, pm):
			if i == n - i:
				return '1' + '\n' + ' '.join([str(i), str(i)])
			else:
				return '2' + '\n' + ' '.join([str(i), str(n - i)]) + '\n' + ' '.join([str(n - i), str(i)])
		else:
			return '0'
	elif check1:
		new = a[i:]
		pm = range(1, len(new) + 1)
		if check(new, pm):
			return '1' + '\n' + ' '.join([str(i), str(n - i)])
		else:
			return '0'
	elif check2:
		new = a[:-i]
		pm = range(1, len(new) + 1)
		if check(new, pm):
			return '1' + '\n' + ' '.join([str(n - i), str(i)])
		else:
			return '0'
	else:
		return '0'
t = int(input())
for _n in range(0, t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	print(solve(n, a))


a = int(input())
for i in range(0, a):
	k = int(input())
	s = list(map(int, input().split()))
	m = max(s)
	n = k - m
	l1 = set(s[0:n])
	l2 = set(s[n:])
	l3 = set(s[0:m])
	l4 = set(s[m:])
	count = 0
	an1 = ''
	an2 = ''
	if set(range(1, n + 1)) == l1 and l2 == set(range(1, m + 1)):
		count = count + 1
		an1 = str(n) + ' ' + str(m)
	if set(range(1, m + 1)) == l3 and l4 == set(range(1, n + 1)):
		count = count + 1
		an2 = str(m) + ' ' + str(n)
		if an1 == an2:
			count = 1
			an2 = ''
	print(count)
	if an1 != '':
		print(an1)
	if an2 != '':
		print(an2)


def dreammoonLikesPermutations(n, array):
	d = {}
	for x in array:
		if x in d:
			d[x] += 1
			if d[x] >= 3:
				return (0, [])
		else:
			d[x] = 1
	for x in range(1, len(d)):
		if not (x in d and x + 1 in d):
			return (0, [])
		if d[x + 1] > d[x]:
			return (0, [])
	s = set()
	for x in range(1, len(d) + 1):
		if d[x] == 2:
			s.add(x)
		else:
			break
	if not s:
		return (0, [])
	v = set()
	ans = []
	for x in range(len(s)):
		v.add(array[x])
	if v == s:
		ans.append([x + 1, n - x - 1])
		if x + 1 == n - x - 1:
			return (len(ans), ans)
	v = set()
	for x in range(n - len(s), n):
		v.add(array[x])
	if v == s:
		ans.append([n - len(s), len(s)])
	return (len(ans), ans)
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	(a, ans) = dreammoonLikesPermutations(n, l)
	if a == 0:
		print(a)
	else:
		print(a)
		for x in ans:
			print(x[0], x[1])


from collections import defaultdict as dc
from heapq import *
import math
import bisect
import sys
from collections import deque as dq
mod = 10 ** 12

def inp():
	p = int(input())
	return p

def line():
	p = list(map(int, input().split()))
	return p

def digit(n):
	s = str(n)
	p = 0
	for i in s:
		p += int(i) ** 2
	return p

def check(a, b):
	c = 0
	for i in range(len(a)):
		if a[i] != b[i]:
			c += 1
			if c > 1:
				return 0
	return 1

def check(a, b, x):
	if a == 1 and b == x:
		return 1
	return 0
for _ in range(inp()):
	n = inp()
	a = line()
	p = dc(int)
	r1 = dc(int)
	mn = float('inf')
	mx = float('-inf')
	for i in range(n):
		mn = min(mn, a[i])
		mx = max(mx, a[i])
		l = i + 1
		p[a[i]] += 1
		if p[a[i]] > 1:
			break
		elif check(mn, mx, l):
			r1[i + 1] += 1
	q = dc(int)
	r2 = dc(int)
	mn = float('inf')
	mx = float('-inf')
	for i in range(n - 1, -1, -1):
		mn = min(mn, a[i])
		mx = max(mx, a[i])
		l = n - i
		q[a[i]] += 1
		if q[a[i]] > 1:
			break
		elif check(mn, mx, l):
			r2[n - i] = 1
	ans = []
	if len(r1) > len(r2):
		for i in r2.keys():
			if r1[n - i] >= 1:
				ans.append((n - i, i))
	else:
		for i in r1.keys():
			if r2[n - i] >= 1:
				ans.append((i, n - i))
	print(len(ans))
	for i in ans:
		print(*i)


from collections import Counter, defaultdict, deque

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def isp(a):
	n = len(a)
	a = set(a)
	for i in range(1, n + 1):
		if i not in a:
			return False
	return True

def slv(N, A):
	sa = [0]
	for a in A:
		sa.append(sa[-1] + a)
	K = []
	for i in range(N):
		n = i + 1
		m = N - n
		ls = sa[i + 1] - sa[0]
		rs = sa[N] - sa[i + 1]
		if ls == (n ** 2 + n) // 2 and rs == (m ** 2 + m) // 2:
			if isp(A[:i + 1]) and isp(A[i + 1:]):
				K.append((n, m))
	print(len(K))
	for k in K:
		print(*k)

def main():
	T = read_int()
	for _ in range(T):
		N = read_int()
		A = read_int_n()
		slv(N, A)
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	positions1 = []
	occured1 = set({})
	max1 = 0
	for i in range(n):
		if a[i] in occured1:
			break
		occured1.add(a[i])
		max1 = max(max1, a[i])
		if len(occured1) == max1:
			positions1.append(i)
	positions2 = set({})
	occured2 = set({})
	max2 = 0
	for j in range(n):
		i = n - j - 1
		if a[i] in occured2:
			break
		occured2.add(a[i])
		max2 = max(max2, a[i])
		if len(occured2) == max2:
			positions2.add(i - 1)
	count = 0
	places = []
	for i in positions1:
		if i in positions2:
			count += 1
			places.append(i)
	print(count)
	for i in places:
		print(i + 1, n - i - 1)


for _ in range(int(input())):
	x = int(input())
	num = list(map(int, input().split()))
	ans = []
	corr = [i for i in range(x)]
	i = max(num)
	for k in range(2):
		if len(set(num[:i])) + len(set(num[i:x])) == x and sorted(num[:i]) == corr[1:i + 1] and (sorted(num[i:x]) == corr[1:x - i + 1]):
			ans.append(i)
		i = x - i
	ans = set(ans)
	print(len(ans))
	for j in ans:
		print(j, x - j)


def isPermutation(l):
	if len(l) == 1:
		if l[0] == 1:
			return True
		else:
			return False
	r = list(range(1, len(l) + 1))
	l1 = l[:]
	l1.sort()
	if l1 == r:
		return True
	else:
		return False
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	counter = 0
	pr = []
	maxval = max(l)
	l1 = l[:n - maxval]
	l2 = l[n - maxval:]
	if isPermutation(l1) and isPermutation(l2):
		counter += 1
		pr.append(n - maxval)
	l1 = l[:maxval]
	l2 = l[maxval:]
	if isPermutation(l1) and isPermutation(l2) and (n - maxval != maxval):
		counter += 1
		pr.append(maxval)
	print(counter)
	for i in range(len(pr)):
		print(pr[i], n - pr[i])


import sys
inp = sys.stdin.readline
read = lambda : list(map(int, inp().split()))
ans = ''
for _ in range(int(inp())):
	n = int(inp())
	arr = read()
	total = sum(arr)
	s1 = 0
	ans_lis = []
	for i in range(n):
		s1 += arr[i]
		total -= arr[i]
		(p1, p2) = (i + 1, n - i - 1)
		if s1 == p1 * (p1 + 1) // 2 and total == p2 * (p2 + 1) // 2 and (len(set(arr[:p1])) == p1) and (len(set(arr[p1:])) == p2):
			ans_lis.append(str(p1) + ' ' + str(p2))
	ans += str(len(ans_lis)) + '\n'
	for i in ans_lis:
		ans += str(i) + '\n'
print(ans)


import sys
input = sys.stdin.readline
from sys import stdin, stdout

def main():
	for _ in range(int(input())):
		n = int(input())
		l = [int(s) for s in input().split()]
		k = 0
		ans = []
		c1 = [0] * n
		c2 = [0] * n
		fr = 0
		tw1 = 0
		rev = 0
		tw2 = 0
		ii = 10 ** 9 + 7
		jj = 0
		c1[l[0] - 1] += 1
		for i in range(1, n):
			c2[l[i] - 1] += 1
			if c2[l[i] - 1] > 1:
				tw2 += 1
		for i in range(n - 1, -1, -1):
			if c2[i] > 0:
				jj = i
				break
		for i in range(n):
			if c2[i] == 0 and i < jj:
				rev += 1
		for i in range(n):
			if c1[i] == 1:
				if i > 0:
					fr += 1
				if ii == 10 ** 9 + 7:
					ii = i + 1
				break
			else:
				ii = min(ii, i)
		if fr == 0 and tw2 == 0 and (rev == 0):
			ans.append([1, n - 1])
			k += 1
		for w in range(1, n - 1):
			if l[w] - 1 >= ii:
				fr += 1
			c1[l[w] - 1] += 1
			c2[l[w] - 1] -= 1
			if c1[l[w] - 1] > 1:
				break
			if c2[l[w] - 1] == 1:
				tw2 -= 1
			else:
				rev += 1
			if l[w] - 1 == jj:
				while jj >= 0 and c2[jj] == 0:
					rev -= 1
					jj -= 1
			if l[w] - 1 == ii:
				while ii < n and c1[ii] == 1:
					fr -= 1
					ii += 1
			if fr == 0 and tw2 == 0 and (rev == 0):
				k += 1
				ans.append([w + 1, n - w - 1])
		print(k)
		for i in ans:
			print(*i)
main()


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	ans = set()
	mx = max(a)
	for x in range(2):
		if set(a[:mx]) == set(range(1, mx + 1)) and set(a[mx:]) == set(range(1, n - mx + 1)):
			ans.add(mx)
		mx = n - mx
	print(len(ans))
	for x in ans:
		print(x, n - x)


I = input
for _ in range(int(I())):
	n = int(I())
	a = list(map(int, I().split(' ')))
	dd = [0 for i in range(n)]
	lm = [a[0]]
	ld = [1]
	t = a[0]
	dd[t - 1] = 1
	c = 1
	for i in range(1, n - 1):
		if a[i] > t:
			t = a[i]
		lm.append(t)
		if dd[a[i] - 1] == 0:
			c += 1
			dd[a[i] - 1] = 1
		ld.append(c)
	dd = [0 for i in range(n)]
	t = a[n - 1]
	rm = [t]
	rd = [1]
	c = 1
	dd[t - 1] = 1
	for i in range(n - 2, 0, -1):
		if a[i] > t:
			t = a[i]
		rm.append(t)
		if dd[a[i] - 1] == 0:
			c += 1
			dd[a[i] - 1] = 1
		rd.append(c)
	rm = rm[::-1]
	rd = rd[::-1]
	ans = []
	for i in range(n - 1):
		if ld[i] == i + 1 and rd[i] == n - i - 1:
			if lm[i] == i + 1 and rm[i] == n - i - 1:
				ans.append([lm[i], rm[i]])
	print(len(ans))
	for i in ans:
		print(i[0], i[1])


import sys

def update(d, req):
	while req in d:
		req += 1
	return req

def solve(a, n, pre2):
	req = 1
	maxi = 0
	d = {}
	for x in range(n):
		if a[x] in d:
			return [0, 0]
		else:
			d[a[x]] = 1
		maxi = max(maxi, a[x])
		if a[x] == req:
			req = update(d, req)
			if maxi != req - 1:
				continue
			elif x + 1 < n and pre2[x + 1]:
				return [x, 1]
			else:
				continue
	return [0, 0]

def solve_back(a, n, pre1):
	d2 = {}
	mx = 0
	rq = 1
	for y in range(n - 1, -1, -1):
		if a[y] in d2:
			return -1
		else:
			d2[a[y]] = 1
		mx = max(mx, a[y])
		if a[y] == rq:
			rq = update(d2, rq)
			if mx != rq - 1:
				continue
			elif y - 1 >= 0 and pre1[y - 1]:
				return y
			else:
				continue
	return -1

def make_pre(a, n):
	pre1 = [False] * n
	d = {}
	maxi = 0
	req = 1
	for x in range(n):
		if a[x] in d:
			break
		else:
			d[a[x]] = 1
		maxi = max(maxi, a[x])
		if a[x] == req:
			req = update(d, req)
			if maxi == req - 1:
				pre1[x] = True
	pre2 = [False] * n
	d2 = {}
	mx = 0
	rq = 1
	for y in range(n - 1, -1, -1):
		if a[y] in d2:
			break
		else:
			d2[a[y]] = 1
		mx = max(mx, a[y])
		if a[y] == rq:
			rq = update(d2, rq)
			if mx == rq - 1:
				pre2[y] = True
	return [pre1, pre2]
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	a = [int(x) for x in sys.stdin.readline().split()]
	[pre1, pre2] = make_pre(a, n)
	arr = solve(a, n, pre2)
	if arr[1] == 0:
		print(0)
	if arr[1] == 1:
		sec = solve_back(a, n, pre1)
		if sec == -1 or sec == arr[0] + 1:
			print(1)
			print(arr[0] + 1, n - arr[0] - 1)
		else:
			print(2)
			print(arr[0] + 1, n - arr[0] - 1)
			print(sec, n - sec)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	l = [False for _ in range(n)]
	r = [False for _ in range(n)]
	cur_max = 0
	s = set()
	for i in range(n):
		el = a[i]
		if el in s:
			break
		s.add(el)
		cur_max = max(cur_max, el)
		if cur_max == len(s):
			l[i] = True
	cur_max = 0
	s = set()
	for i in range(n - 1, -1, -1):
		el = a[i]
		if el in s:
			break
		s.add(el)
		cur_max = max(cur_max, el)
		if cur_max == len(s):
			r[i] = True
	ans = 0
	for i in range(n - 1):
		if l[i] and r[i + 1]:
			ans += 1
	print(ans)
	for i in range(n - 1):
		if l[i] and r[i + 1]:
			print('{} {}'.format(str(i + 1), str(n - i - 1)))


for _ in range(int(input())):
	n = int(input())
	s = map(int, input().split())
	s = list(s)
	a = set()
	se = set()
	m = 0
	for i in range(n - 1):
		if s[i] in se:
			break
		se.add(s[i])
		m = max(m, s[i])
		if m == i + 1:
			a.add(m)
	b = set()
	se = set()
	m = 0
	for i in range(n - 1, 0, -1):
		if s[i] in se:
			break
		se.add(s[i])
		m = max(m, s[i])
		if m == n - i:
			b.add(m)
	ans = []
	for i in a:
		if n - i in b:
			ans.append([i, n - i])
	print(len(ans))
	for (a, b) in ans:
		print(a, b)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	set1 = set()
	set2 = set()
	_max1 = 0
	_max2 = 0
	possible1 = [False] * n
	possible2 = [False] * n
	cancelled1 = False
	cancelled2 = False
	for i in range(n):
		j = n - i - 1
		_max1 = max(_max1, a[i])
		_max2 = max(_max2, a[j])
		if not cancelled1 and a[i] not in set1:
			set1.add(a[i])
		else:
			cancelled1 = True
		if not cancelled2 and a[j] not in set2:
			set2.add(a[j])
		else:
			cancelled2 = True
		if not cancelled1:
			possible1[i] = _max1 == len(set1)
		if not cancelled2:
			possible2[j] = _max2 == len(set2)
	indices = []
	for i in range(n - 1):
		if possible1[i] and possible2[i + 1]:
			indices.append([i, i + 1])
	print(len(indices))
	for i in range(len(indices)):
		print(indices[i][0] + 1, n - indices[i][1])


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *

def main():
	for t in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		b = Counter(a)
		ans = -1
		for i in b:
			if b[i] > 2:
				ans = 0
				break
		if ans == 0:
			print(0)
		else:
			c = []
			b = len(set(a))
			d = set()
			for i in range(n - b):
				d.add(a[i])
			e = set()
			for i in range(n - b, n, 1):
				e.add(a[i])
			f = 0
			for i in range(n - b):
				if i + 1 not in d:
					f = 1
					break
			f1 = 0
			for i in range(b):
				if i + 1 not in e:
					f1 = 1
					break
			if f == 0 and f1 == 0:
				c.append([n - b, b])
			d = set()
			for i in range(b):
				d.add(a[i])
			e = set()
			for i in range(b, n, 1):
				e.add(a[i])
			f = 0
			for i in range(b):
				if i + 1 not in d:
					f = 1
					break
			f1 = 0
			for i in range(n - b):
				if i + 1 not in e:
					f1 = 1
					break
			if f == 0 and f1 == 0:
				c.append([b, n - b])
				if len(c) == 2:
					if c[1][0] == c[0][0] and c[1][1] == c[0][1]:
						c.pop()
			print(len(c))
			for i in c:
				print(*i)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def comp(n, s):
	x = n * (n + 1) // 2
	if x == s:
		return True
	else:
		return False

def comp2(n, s):
	x = n * (n + 1) // 2
	x = x ** 2
	if x == s:
		return True
	else:
		return False

def comp1(n, s):
	x = n * (n + 1) * (2 * n + 1) // 6
	if x == s:
		return True
	else:
		return False

def computeXOR(n):
	if n % 4 == 0:
		return n
	if n % 4 == 1:
		return 1
	if n % 4 == 2:
		return n + 1
	return 0
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = [0] * n
	ans1 = [0] * n
	ans2 = [0] * n
	ans[0] = l[0]
	ans1[0] = l[0] * l[0]
	ans2[0] = l[0] * l[0] * l[0]
	for i in range(1, n):
		ans[i] = l[i] + ans[i - 1]
		ans1[i] = l[i] * l[i] + ans1[i - 1]
		ans2[i] = l[i] * l[i] * l[i] + ans2[i - 1]
	final = []
	for i in range(n):
		if comp(i + 1, ans[i]) and comp(n - i - 1, ans[n - 1] - ans[i]) and comp1(i + 1, ans1[i]) and comp1(n - i - 1, ans1[n - 1] - ans1[i]) and comp2(i + 1, ans2[i]) and comp2(n - i - 1, ans2[n - 1] - ans2[i]):
			final.append(i + 1)
			final.append(n - i - 1)
	if len(final):
		print(len(final) // 2)
		for i in range(0, len(final), 2):
			print(final[i], end=' ')
			print(final[i + 1])
	else:
		print(0)


t = int(input())

def check(l):
	b = list(range(1, len(l) + 1))
	l.sort()
	if l == b:
		return True
	else:
		return False
for i in range(t):
	count = 0
	c = []
	k = int(input())
	x = [int(x) for x in input().split()]
	for j in [max(x), k - max(x)]:
		a1 = x[:j]
		a2 = x[j:]
		if check(a1) and check(a2):
			c.append(j)
	c = list(set(c))
	print(len(c))
	for m in range(len(c)):
		print(c[m], k - c[m])


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	c = Counter(a)
	m = max(c)
	possible = True
	for i in range(1, m + 1):
		if c[i] not in [1, 2]:
			possible = False
	l1 = m
	for i in range(1, m + 1):
		if c[i] != 2:
			l1 = i - 1
			break
	if c[1] == 0:
		possible = False
	for i in range(l1 + 1, m + 1):
		if c[i] != 1:
			possible = False
	if possible:
		total = 0
		firstP = False
		if set(a[:l1]) == set((i for i in range(1, l1 + 1))):
			if set(a[l1:]) == set((i for i in range(1, m + 1))):
				total += 1
				firstP = True
		if m != l1 and set(a[:m]) == set((i for i in range(1, m + 1))):
			if set(a[m:]) == set((i for i in range(1, l1 + 1))):
				total += 1
		print(total)
		if firstP:
			print(l1, m)
		if not firstP and total or (total == 2 and m != l1):
			print(m, l1)
	else:
		print(0)


t = int(input())
for i in range(t):
	n = int(input())
	pos = [int(k) for k in input().split()]
	dic1 = {}
	dic2 = {}
	i = 0
	(a, b, c, d) = (0, n - 1, 0, n - 1)
	while i < n:
		try:
			(a, b) = (dic1[pos[i]], i)
			break
		except:
			dic1[pos[i]] = i
			i += 1
	i = n - 1
	while i >= 0:
		try:
			(c, d) = (i, dic2[pos[i]])
			break
		except:
			dic2[pos[i]] = i
			i -= 1
	if b <= c:
		print(0)
		continue
	sm1 = 0
	sm2 = sum(pos)
	i = 0
	ans = []
	while i < c:
		sm1 += pos[i]
		sm2 -= pos[i]
		i += 1
	while i < b:
		sm1 += pos[i]
		sm2 -= pos[i]
		if sm1 == (i + 1) * (i + 2) // 2 and sm2 == (n - i) * (n - i - 1) // 2:
			ans.append(i + 1)
		i += 1
	print(len(ans))
	for k in ans:
		print(k, n - k)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	c = 0
	d = 0
	for i in range(n):
		if arr[i] == 1 and c == 0:
			first = i
			c += 1
		elif arr[i] == 1 and c == 1:
			second = i
			c += 1
		elif arr[i] == 1:
			c += 1
	if c == 2:
		var = 1
		temp = [False] * n
		s = set()
		for i in range(n):
			if arr[i] in s:
				break
			s.add(arr[i])
			while var in s:
				s.remove(var)
				var += 1
			if len(s) == 0:
				temp[i] = True
			else:
				temp[i] = False
		var = 1
		newTemp = [False] * n
		arr.reverse()
		s = set()
		for i in range(n):
			if arr[i] in s:
				break
			s.add(arr[i])
			while var in s:
				s.remove(var)
				var += 1
			if len(s) == 0:
				newTemp[i] = True
			else:
				newTemp[i] = False
		newTemp.reverse()
		ans = []
		for i in range(n - 1):
			if temp[i] == newTemp[i + 1] == 1:
				ans.append((i + 1, n - i - 1))
		print(len(ans))
		if len(ans):
			for (l, r) in ans:
				print(l, r)
	else:
		print(0)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	maxi = max(arr)
	li = []
	for k in range(2):
		if set(arr[:maxi]) == set(range(1, maxi + 1)) and set(arr[maxi:]) == set(range(1, n - maxi + 1)):
			li.append(maxi)
		maxi = n - maxi
	li = set(li)
	print(len(li))
	for i in li:
		print(i, n - i)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	s = max(l)
	s1 = n - s
	if s1 <= 0:
		print(0)
		continue
	p1 = set()
	p2 = set()
	d = set()
	d1 = set()
	lw = []
	ans = 0
	for j in range(s1):
		d.add(j + 1)
	for j in range(s):
		d1.add(j + 1)
	for j in range(s1):
		p1.add(l[j])
	for j in range(s1, n):
		p2.add(l[j])
	if p1 == d and p2 == d1:
		ans += 1
		lw.append([s1, s])
		if s == s1:
			print(1)
			print(s1, s)
			continue
	p1 = set()
	p2 = set()
	for j in range(s):
		p2.add(l[j])
	for j in range(s, n):
		p1.add(l[j])
	if p1 == d and p2 == d1:
		ans += 1
		lw.append([s, s1])
	print(ans)
	for j in range(len(lw)):
		print(lw[j][0], lw[j][1])


t = int(input())
while t > 0:
	n = int(input())
	a = [int(x) for x in input().split()]
	b = []
	for i in range(n + 1):
		b.append(-1)
	k1 = -1
	for i in range(n):
		if b[a[i]] == -1:
			b[a[i]] = i
		else:
			k1 = i
			break
	for i in range(n + 1):
		b[i] = -1
	k2 = -1
	for i in range(n - 1, -1, -1):
		if b[a[i]] == -1:
			b[a[i]] = i
		else:
			k2 = i
			break
	if k1 > k2:
		temp = k1
		k1 = k2
		k2 = temp
	if k1 == -1 or k2 == -1:
		print(0)
		t -= 1
		continue
	a1 = []
	a2 = []
	b1 = []
	b2 = []
	for i in range(n):
		if i <= k1:
			a1.append(a[i])
		else:
			a2.append(a[i])
	for i in range(n):
		if i < k2:
			b1.append(a[i])
		else:
			b2.append(a[i])
	a1.sort()
	a2.sort()
	b1.sort()
	b2.sort()
	flaga = 0
	flagb = 0
	for i in range(1, len(a1)):
		if a1[i] - 1 != a1[i - 1]:
			flaga = 1
	for i in range(1, len(a2)):
		if a2[i] - 1 != a2[i - 1]:
			flaga = 1
	for i in range(1, len(b1)):
		if b1[i] - 1 != b1[i - 1]:
			flagb = 1
	for i in range(1, len(b2)):
		if b2[i] - 1 != b2[i - 1]:
			flagb = 1
	if a1[0] != 1 and a1[-1] != k1 + 1:
		flaga = 1
	if a2[0] != 1 and a2[-1] != n - (k1 + 1):
		flaga = 1
	if b1[0] != 1 and b1[-1] != k2:
		flagb = 1
	if b2[0] != 1 and b2[-1] != n - k2:
		flagb = 1
	if a1 == b1 and a2 == b2:
		flagb = 1
	print(2 - (flagb + flaga))
	if flaga == 0:
		print(k1 + 1, n - (k1 + 1))
	if flagb == 0:
		print(k2, n - k2)
	t -= 1


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	aa = list(map(int, input().split()))
	ss = set()
	st = 0
	ind = 1
	pre = [0 for i in range(n)]
	for i in range(n):
		if aa[i] in ss:
			break
		ss.add(aa[i])
		while ind <= len(ss):
			if ind in ss:
				ind += 1
			else:
				break
		if len(ss) != ind - 1:
			pre[i] = 0
		else:
			pre[i] = ind
	ind = 1
	ss = set()
	suff = [0 for i in range(n)]
	for i in range(n - 1, -1, -1):
		if aa[i] in ss:
			break
		ss.add(aa[i])
		while ind <= len(ss):
			if ind in ss:
				ind += 1
			else:
				break
		if len(ss) != ind - 1:
			suff[i] = 0
		else:
			suff[i] = ind
	tot = 0
	ans = []
	for i in range(n - 1):
		if pre[i] > 0 and suff[i + 1] > 0:
			tot += 1
			ans.append([i + 1, n - i - 1])
	print(tot)
	for i in ans:
		print(i[0], i[1])


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	mx = max(x)
	m = n - mx
	if n == 1 or m <= 0 or m > mx:
		print(0)
	else:
		d1 = Counter(x[:m])
		d2 = Counter(x[m:])
		f1 = 1
		f2 = 1
		for i in range(1, m + 1):
			if i not in d1:
				f1 = 0
				break
			elif d1[i] > 1:
				f1 = 0
				break
		for i in range(1, mx + 1):
			if i not in d2:
				f1 = 0
				break
			elif d2[i] > 1:
				f1 = 0
				break
		d1 = Counter(x[:mx])
		d2 = Counter(x[mx:])
		for i in range(1, m + 1):
			if i not in d2:
				f2 = 0
				break
			elif d2[i] > 1:
				f2 = 0
				break
		for i in range(1, mx + 1):
			if i not in d1:
				f2 = 0
				break
			elif d1[i] > 1:
				f2 = 0
				break
		if f1 == 1 and f2 == 1:
			if m != mx:
				print(2)
				print(m, mx)
				print(mx, m)
			else:
				print(1)
				print(m, mx)
		elif f1 == 1 and f2 == 0:
			print(1)
			print(m, mx)
		elif f1 == 0 and f2 == 1:
			print(1)
			print(mx, m)
		else:
			print(0)


import sys
input = sys.stdin.readline

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	n = int(input())
	a = int_array()
	left = []
	xset = set()
	length = 0
	mini = INF
	maxi = NINF
	for i in a:
		if i in xset:
			break
		xset.add(i)
		length += 1
		mini = min(i, mini)
		maxi = max(maxi, i)
		if mini == 1 and maxi == length:
			left.append(length)
	a = a[::-1]
	first = left.copy()
	left = []
	xset = set()
	length = 0
	mini = INF
	maxi = NINF
	for i in a:
		if i in xset:
			break
		xset.add(i)
		length += 1
		mini = min(i, mini)
		maxi = max(maxi, i)
		if mini == 1 and maxi == length:
			left.append(length)
	first = set(first)
	second = set(left)
	ans = 0
	this = []
	for i in first:
		if n - i in second:
			ans += 1
			this.append((i, n - i))
	print(ans)
	for i in this:
		print(*i)


def perm(A):
	max_a = 0
	S = set()
	ret = set()
	for (i, a) in enumerate(A):
		if max_a < a:
			max_a = a
		S.add(a)
		if max_a == i + 1 and len(S) == i + 1:
			ret.add(max_a)
	return ret

def main():
	for _ in [0] * int(input()):
		n = int(input())
		A = list(map(int, input().split()))
		left = perm(A)
		right = perm(A[::-1])
		ans = []
		for l in left:
			if n - l in right:
				ans.append(l)
		print(len(ans))
		[print(l, n - l) for l in ans]
main()


cycles = int(input())

def find_first(vals, high, high2):
	s1 = set(range(1, high + 1))
	s2 = set(range(1, high2 + 1))
	for i in range(high):
		val = vals[i]
		if val not in s1:
			return []
		else:
			s1.remove(val)
	if len(s1) != 0:
		return []
	for i in range(high, high + high2):
		val = vals[i]
		if val not in s2:
			return []
		else:
			s2.remove(val)
	if len(s2) != 0:
		return []
	return [[high, high2]]

def find_second(vals, high, high2):
	s1 = set(range(1, high + 1))
	s2 = set(range(1, high2 + 1))
	for i in range(high2):
		val = vals[i]
		if val not in s2:
			return []
		else:
			s2.remove(val)
	if len(s2) != 0:
		return []
	for i in range(high2, high + high2):
		val = vals[i]
		if val not in s1:
			return []
		else:
			s1.remove(val)
	if len(s1) != 0:
		return []
	return [[high2, high]]

def find(vals):
	if len(vals) < 2:
		return []
	elif len(vals) == [1, 1]:
		return [[1, 1]]
	else:
		high = max(vals)
		high2 = len(vals) - high
		if high == high2:
			return find_first(vals, high, high2)
		return find_second(vals, high, high2) + find_first(vals, high, high2)
results = []
for cycle in range(cycles):
	n = int(input())
	vals = map(int, input().split())
	results.append(find(list(vals)))
for r in results:
	print(len(r))
	for s in r:
		print('%d %d' % (s[0], s[1]))


def permutationChecker(a):
	temp_dict = {}
	for f1 in a:
		if f1 not in temp_dict.keys():
			temp_dict[f1] = 1
		else:
			temp_dict[f1] += 1
	for f1 in range(1, max(temp_dict.keys()) + 1, 1):
		if f1 not in temp_dict.keys():
			return False
		elif temp_dict[f1] > 1:
			return False
	return True
testCases = int(input())
for i1 in range(testCases):
	length = int(input())
	numbers = list(map(int, input().split()))
	index = max(numbers)
	max_count = numbers.count(index)
	if max_count == 2:
		if length % 2 == 1:
			print(0)
		else:
			left = permutationChecker(numbers[0:length // 2])
			right = permutationChecker(numbers[length // 2:length])
			if left and right:
				print(1)
				print(length // 2, length // 2)
			else:
				print(0)
		continue
	left_included = permutationChecker(numbers[0:index])
	left_excluded = permutationChecker(numbers[0:length - index])
	right_excluded = permutationChecker(numbers[index:length])
	right_included = permutationChecker(numbers[length - index:length])
	result = 0
	solution = []
	if left_excluded and right_included:
		result += 1
		solution.append([length - index, index])
	if left_included and right_excluded:
		result += 1
		solution.append([index, length - index])
	if result == 0:
		print(0)
	else:
		print(result)
		for i2 in solution:
			print(i2[0], i2[1])


def give(n):
	return n * (n + 1) // 2
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * n
	sum = 0
	i = 0
	one = [0] * n
	while i <= n - 2:
		if b[a[i]]:
			break
		sum += a[i]
		b[a[i]] = 1
		if sum == give(i + 1):
			one[i] += i + 1
		i += 1
	k = 0
	this = []
	b = [0] * n
	sum = 0
	i = n - 1
	while i >= 1:
		if b[a[i]]:
			break
		sum += a[i]
		b[a[i]] = 1
		if sum == give(n - i):
			one[i - 1] += n - i
		i -= 1
	for i in range(n):
		if one[i] == n:
			k += 1
			this.append([i + 1, n - i - 1])
	print(k)
	for x in this:
		print(*x)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	pref = dict()
	suff = dict()
	mx = 0
	curr = set()
	for i in range(n):
		if a[i] > mx:
			mx = a[i]
		curr.add(a[i])
		if mx == i + 1 and len(curr) == i + 1:
			pref[i + 1] = True
		else:
			pref[i + 1] = False
	mx = 0
	curr = set()
	for i in range(n):
		j = n - i - 1
		if a[j] > mx:
			mx = a[j]
		curr.add(a[j])
		if mx == i + 1 and len(curr) == i + 1:
			suff[i + 1] = True
		else:
			suff[i + 1] = False
	k = 0
	ans = []
	for i in range(1, n + 1):
		if pref[i] and suff[n - i]:
			ans.append(str(i) + ' ' + str(n - i))
			k += 1
	print(k)
	for i in range(k):
		print(ans[i])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ml = [0 for _ in range(n)]
	mr = [0 for _ in range(n)]
	mr[-1] = a[-1]
	ml[0] = a[0]
	for i in range(1, len(a)):
		ml[i] = max(ml[i - 1], a[i])
	for i in range(len(a) - 2, -1, -1):
		mr[i] = max(mr[i + 1], a[i])
	llegnth = [0 for _ in range(n)]
	rlength = [0 for _ in range(n)]
	temp = set()
	temp.add(a[0])
	llegnth[0] = 1
	for i in range(1, n):
		temp.add(a[i])
		llegnth[i] = len(temp)
	temp = set()
	temp.add(a[-1])
	rlength[-1] = 1
	for i in range(n - 2, -1, -1):
		temp.add(a[i])
		rlength[i] = len(temp)
	total = 0
	ans = []
	for i in range(0, n):
		if ml[i] == i + 1 and llegnth[i] == i + 1 and (mr[i + 1] == n - i - 1) and (rlength[i + 1] == n - i - 1):
			total += 1
			ans.append((i + 1, n - i - 1))
	print(total)
	for i in ans:
		print(i[0], i[1])


for _ in range(int(input())):
	n = int(input())
	a = input().split(' ')
	for i in range(n):
		a[i] = int(a[i])
	l1 = max(a)
	d = []
	for j in range(2):
		if set(a[:l1]) == set(range(1, l1 + 1)) and set(a[l1:]) == set(range(1, n - l1 + 1)):
			d.append(l1)
		l1 = n - l1
	d = set(d)
	print(len(d))
	if len(d) > 0:
		for i in d:
			print(i, n - i)


import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	(*a,) = map(int, input().split())
	ok = [0] * n
	okrev = [0] * n
	ma = le = 0
	se = set()
	for (i, x) in enumerate(a):
		if x not in se:
			se.add(x)
			le += 1
		if x > ma:
			ma = x
		if ma == le == i + 1:
			ok[i] = 1
	ma = le = 0
	se = set()
	for (i, x) in enumerate(a[::-1]):
		if x not in se:
			se.add(x)
			le += 1
		if x > ma:
			ma = x
		if ma == le == i + 1:
			okrev[i] = 1
	c = 0
	ans = []
	for i in range(n - 1):
		if ok[i] and okrev[n - i - 2]:
			c += 1
			ans.append('{} {}'.format(i + 1, n - i - 1))
	print(c)
	if c:
		print('\n'.join(ans))


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	maxx = max(l)
	a = n - maxx
	d1 = {}
	d2 = {}
	for j in range(1, a + 1):
		d1[j] = 0
	for j in range(1, maxx + 1):
		d2[j] = 0
	for j in range(n):
		if j < a:
			if d1.get(l[j]) != None:
				d1[l[j]] += 1
		elif d2.get(l[j]) != None:
			d2[l[j]] += 1
	check1 = 0
	for j in d1:
		if d1[j] == 0 or d1[j] > 1:
			check1 = 1
			break
	for j in d2:
		if d2[j] == 0 or d2[j] > 1:
			check1 = 1
			break
	d1 = {}
	d2 = {}
	for j in range(1, maxx + 1):
		d1[j] = 0
	for j in range(1, a + 1):
		d2[j] = 0
	for j in range(n):
		if j < maxx:
			if d1.get(l[j]) != None:
				d1[l[j]] += 1
		elif d2.get(l[j]) != None:
			d2[l[j]] += 1
	check2 = 0
	if a == maxx:
		check2 = 1
	for j in d1:
		if d1[j] == 0 or d1[j] > 1:
			check2 = 1
			break
	for j in d2:
		if d2[j] == 0 or d2[j] > 1:
			check2 = 1
			break
	if check1 == 0 and check2 == 0:
		print(2)
	elif check1 == 0 or check2 == 0:
		print(1)
	else:
		print(0)
	if check1 == 0:
		print(a, end=' ')
		print(maxx)
	if check2 == 0:
		print(maxx, end=' ')
		print(a)


import sys
import math

def fn(n, a):
	l2 = max(a)
	l1 = n - l2
	m2 = []
	if l2 >= n:
		print(0)
		return 0
	for i in range(1, l2 + 1):
		m2.append(i)
	m1 = []
	for i in range(1, l1 + 1):
		m1.append(i)
	a1 = a[:l2]
	a2 = a[l2:]
	b1 = a[:l1]
	b2 = a[l1:]
	a1.sort()
	a2.sort()
	b1.sort()
	b2.sort()
	flag = 0
	c = 0
	if m2 == a1 and m1 == a2:
		flag = 1
		c = c + 1
	if m1 == b1 and m2 == b2:
		flag = 2
		c = c + 1
	if l1 == l2 and c == 2:
		print(1)
		print(l1, l2)
		return 0
	if c == 0:
		print(0)
	elif c == 2:
		print(2)
		print(l1, l2)
		print(l2, l1)
		return 0
	elif c == 1:
		print(1)
		if flag == 1:
			print(l2, l1)
		else:
			print(l1, l2)
		return 0
input = sys.stdin.read()
data = list(map(int, input.split()))
t = data[0]
l = 0
for i in range(t):
	n = data[l + 1]
	a = data[l + 2:l + 2 + n]
	l = l + 1 + n
	fn(n, a)


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	cs = 0
	ca = [0] * n
	csa = [0] * n
	for i in range(n):
		c += a[i]
		cs += a[i] * a[i] * a[i]
		ca[i] = c
		csa[i] = cs
	count = 0
	ans = []
	for i in range(n - 1):
		N = i + 1
		k = n - N
		if ca[i] == N * (N + 1) // 2 and ca[-1] - ca[i] == k * (k + 1) // 2 and (csa[i] == N * (N + 1) // 2 * (N * (N + 1) // 2)) and (csa[-1] - csa[i] == k * (k + 1) // 2 * (k * (k + 1) // 2)):
			count += 1
			ans.append([N, k])
	print(count)
	for i in ans:
		print(*i)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	mas = [0 for i in range(n)]
	for i in range(n):
		mas[a[i] - 1] += 1
	boo = 1
	n1 = n
	ind = 0
	while n1 != 0:
		if mas[ind] == 0:
			boo = 0
		n1 -= mas[ind]
		ind += 1
	if boo == 0:
		print(0)
		continue
	maxx = -1
	xex = max(a)
	if max(mas) > 2:
		print(0)
		continue
	while mas[maxx + 1] == 2:
		maxx += 1
	if mas.count(2) != maxx + 1:
		print(0)
		continue
	ans = []
	lol = [0 for i in range(n)]
	for i in range(maxx + 1):
		lol[a[i] - 1] += 1
	boo = 1
	for i in range(maxx + 1):
		if lol[i] != 1:
			boo = 0
	if boo == 1 and maxx != -1:
		ans.append([maxx + 1, xex])
	for i in range(maxx + 1, xex):
		lol[a[i] - 1] += 1
	boo = 1
	for i in range(xex):
		if lol[i] != 1:
			boo = 0
	if boo == 1 and maxx != -1:
		ans.append([xex, maxx + 1])
	if len(ans) == 2:
		if ans[1] == ans[0]:
			ans.pop()
	print(len(ans))
	for i in ans:
		print(*i)


from math import *
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	(n, a) = (int(input()), list(map(int, input().split())))
	(m, li) = (max(a), [])
	for i in {m, n - m}:
		if sorted(a[:i]) + sorted(a[i:]) == [*range(1, i + 1), *range(1, n - i + 1)]:
			li.append(i)
	print(len(li))
	for i in li:
		print(i, n - i)


T = int(input())
for case in range(T):
	m = int(input())
	ls = [int(x) for x in input().split()]
	ma = 0
	p = set()
	pn = set()
	negn = set()
	neg = set()
	for (n, e) in enumerate(ls):
		ma = max(ma, e)
		pn.add(e)
		if ma == n + 1 and len(pn) == ma:
			p.add(n + 1)
	ls = ls[::-1]
	ma = 0
	for (n, e) in enumerate(ls):
		ma = max(ma, e)
		negn.add(e)
		if ma == n + 1 and len(negn) == ma:
			neg.add(n + 1)
	ret = []
	for i in range(1, m):
		if i in p and m - i in neg:
			ret.append(i)
	print(len(ret))
	for r in ret:
		print(r, m - r)


from collections import Counter

def solve():
	n = int(input())
	l1 = list(map(int, input().split()))
	d = Counter(l1)
	v1 = list(d.keys())
	c = 0
	sum1 = sum(l1)
	kk = []
	xx = 0
	for i in range(len(v1)):
		if d[v1[i]] == 2:
			c = c + 1
	s2 = len(d)
	f1 = (c + 1) * c // 2
	f2 = (s2 + 1) * s2 // 2
	a = sum(l1[0:c])
	b = sum1 - a
	if f1 == a and f2 == b and (a + b == sum1) and (c + s2 == n):
		xx += 1
		kk.append(c)
		kk.append(s2)
	a1 = sum(l1[0:s2])
	b1 = sum1 - a1
	if a1 == f2 and b1 == f1 and (a + b == sum1) and (c + s2 == n):
		xx = xx + 1
		kk.append(s2)
		kk.append(c)
	if s2 == c:
		if xx > 0:
			xx = xx - 1
			kk.pop()
			kk.pop()
	print(xx)
	for i in range(0, len(kk), 2):
		print(kk[i], kk[i + 1])
for _ in range(int(input())):
	solve()


def findRepeating(arr):
	s = set()
	for i in range(len(arr)):
		if arr[i] in s:
			return arr[i]
		s.add(arr[i])
	return -1

def check_elements(arr, n, A, B):
	rangeV = B - A
	for i in range(0, n):
		if abs(arr[i]) >= A and abs(arr[i]) <= B:
			z = abs(arr[i]) - A
			if arr[z] > 0:
				arr[z] = arr[z] * -1
	count = 0
	for i in range(0, rangeV + 1):
		if i >= n:
			break
		if arr[i] > 0:
			return False
		else:
			count = count + 1
	if count != rangeV + 1:
		return False
	return True
for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	A = 1
	B = max(arr)
	a = 0
	if B * 2 != n and check_elements(arr[0:B], B, A, B) and check_elements(arr[B:n], n - B, A, n - B):
		if findRepeating(arr[0:B]) == -1 and findRepeating(arr[B:n]) == -1:
			a = a + 1
	if check_elements(arr[0:n - B], n - B, A, n - B) and check_elements(arr[n - B:n], B, A, B):
		if findRepeating(arr[0:n - B]) == -1 and findRepeating(arr[n - B:n]) == -1:
			a = a + 1
	print(a)
	if check_elements(arr[0:n - B], n - B, A, n - B) and check_elements(arr[n - B:n], B, A, B):
		if findRepeating(arr[0:n - B]) == -1 and findRepeating(arr[n - B:n]) == -1:
			print(n - B, B)
	if B * 2 != n and check_elements(arr[0:B], B, A, B) and check_elements(arr[B:n], n - B, A, n - B):
		if findRepeating(arr[0:B]) == -1 and findRepeating(arr[B:n]) == -1:
			print(B, n - B)


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	pre_arr = [0] * n
	for i in range(n):
		if i == 0:
			pre_arr[i] = arr[i]
		else:
			pre_arr[i] = pre_arr[i - 1] + arr[i]
	Dict = defaultdict(int)
	Dict1 = defaultdict(int)
	dist = [0] * n
	for i in range(n):
		if Dict[arr[i]] == 0:
			dist[i] = dist[i - 1] + 1
			Dict[arr[i]] = 1
		else:
			dist[i] = dist[i - 1]
	dist1 = [0] * n
	for i in range(n - 1, -1, -1):
		if Dict1[arr[i]] == 0:
			if i == n - 1:
				dist1[i] = 1
			else:
				dist1[i] = dist1[i + 1] + 1
			Dict1[arr[i]] = 1
		else:
			dist1[i] = dist1[i + 1]
	ans = 0
	lis = []
	for i in range(1, n):
		temp1 = pre_arr[i - 1]
		temp2 = pre_arr[n - 1] - pre_arr[i - 1]
		che1 = i * (i + 1) // 2
		che2 = (n - i) * (n - i + 1) // 2
		if (temp1 == che1 and dist[i - 1] == i) and (temp2 == che2 and dist1[i] == n - i):
			lis.append((i, n - i))
			ans += 1
	print(ans)
	if len(lis) > 0:
		for i in lis:
			print(i[0], i[1])


def check(temp):
	vis = [-1] * temp
	for i in range(temp):
		if l[i] - 1 < len(vis) and l[i] - 1 >= 0:
			vis[l[i] - 1] = 1
	vis2 = [-1] * (len(l) - temp)
	for i in range(temp, len(l)):
		if l[i] - 1 < len(vis2) and l[i] - 1 >= 0:
			vis2[l[i] - 1] = 1
	if -1 in vis or -1 in vis2:
		return False
	return True
for nt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	v = [-1] * n
	ans = []
	s = sum(l)
	s1 = l[0]
	s2 = s - s1
	for i in range(1, n):
		if s1 == i * (i + 1) // 2 and s2 == (n - i) * (n - i + 1) // 2:
			if check(i):
				ans.append(i)
		s1 += l[i]
		s2 -= l[i]
	print(len(ans))
	for i in ans:
		print(i, n - i)


import sys
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		try:
			d[i] += 1
		except:
			d[i] = 1
	flag = True
	length = len(d)
	for i in range(1, length + 1):
		try:
			if d[i] > 2:
				flag = False
				break
		except:
			flag = False
	if flag == False:
		print(0)
	else:
		summ = 0
		for i in l:
			summ += i
		sum_d = {}
		sum_d[1] = 1
		length += 1
		for i in range(2, length):
			sum_d[i] = i + sum_d[i - 1]
		current = 0
		ans = []
		for i in range(n - 1):
			current += l[i]
			try:
				if sum_d[i + 1] == current and sum_d[n - i - 1] == summ - current:
					ans.append([i + 1, n - i - 1])
			except:
				pass
		print(len(ans))
		for i in ans:
			print(str(i[0]) + ' ' + str(i[1]))


from sys import stdin
input = stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	A = [int(j) for j in input().strip().split()]
	maxi = max(A)
	x = n - maxi
	a = maxi * (maxi + 1) // 2
	b = x * (x + 1) // 2
	if sum(A) != a + b or maxi >= n:
		print(0)
		continue
	pk = []
	if sum(set(A[:x])) == b and sum(set(A[x:])) == a:
		pk.append((x, maxi))
	if x != maxi and sum(set(A[:maxi])) == a and (sum(set(A[maxi:])) == b):
		pk.append((maxi, x))
	print(len(pk))
	for j in pk:
		print(j[0], j[1])


import sys
for _ in range(int(sys.stdin.readline())):
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	count = [0] * n
	for i in range(n):
		count[a[i] - 1] += 1
	if 2 not in count:
		print(0)
		continue
	l1 = max([i + 1 for i in range(n) if count[i] == 2])
	l2 = n - l1
	num = 0
	tup = []
	if sorted(a[:l1]) == list(range(1, l1 + 1)) and sorted(a[l1:l1 + l2]) == list(range(1, l2 + 1)):
		num += 1
		tup.append([l1, l2])
	if l1 == l2:
		print(num)
		for x in tup:
			print(*x)
		continue
	(l1, l2) = (l2, l1)
	if sorted(a[:l1]) == list(range(1, l1 + 1)) and sorted(a[l1:l1 + l2]) == list(range(1, l2 + 1)):
		num += 1
		tup.append([l1, l2])
	print(num)
	for x in tup:
		print(*x)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	dpF = [0 for i in range(n)]
	dpB = [0 for i in range(n)]
	noRep = 1
	r = {}
	m = 0
	for i in range(n):
		if r.get(a[i]) == None:
			r[a[i]] = 1
			m = max(m, a[i])
			if m == i + 1:
				dpF[i] = 1
		else:
			break
	r = {}
	m = 0
	for i in range(n - 1, -1, -1):
		if r.get(a[i]) == None:
			r[a[i]] = 1
			m = max(m, a[i])
			if m == n - i:
				dpB[i] = 1
		else:
			break
	ans = 0
	ansList = []
	for i in range(n - 1):
		if dpF[i] == 1 and dpB[i + 1] == 1:
			ans += 1
			ansList.append([i + 1, n - i - 1])
	print(ans)
	for i in ansList:
		print(i[0], i[1])


for ii in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	mv = max(arr)
	total = sum(arr)
	s = 0
	ans = []
	for i in range(n):
		s += arr[i]
		total -= arr[i]
		(p1, p2) = (i + 1, n - i - 1)
		if s == p1 * (p1 + 1) // 2 and total == p2 * (p2 + 1) // 2 and (len(set(arr[:p1])) == p1) and (len(set(arr[p1:])) == p2):
			ans.append([p1, p2])
	print(len(ans))
	for i in ans:
		print(i[0], i[1])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	pre = [0]
	suf = [0]
	d5 = {}
	d6 = {}
	for t in l:
		if d5.get(t, 0) == 1:
			break
		d5[t] = 1
		x = pre[-1] + t
		pre.append(x)
	for t in l[::-1]:
		if d6.get(t, 0) == 1:
			break
		d6[t] = 1
		x = suf[-1] + t
		suf.append(x)
	p1 = []
	p2 = []
	for t in range(1, len(pre)):
		if pre[t] == t * (t + 1) // 2:
			p1.append(t)
	for t in range(1, len(suf)):
		if suf[t] == t * (t + 1) // 2:
			p2.append(n - t + 1)
	if len(p1) == 0 or len(p2) == 0:
		print(0)
	else:
		d = {}
		ans = []
		for t in p2:
			d[t] = 1
		for t in p1:
			if d.get(t + 1, 0) == 1:
				ans.append([t, n - t])
		print(len(ans))
		for t in ans:
			print(*t)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = max(l)
	k = n - x
	c = 0
	a = []
	p = [0] * (n - x)
	q = [0] * x
	for i in range(n):
		try:
			if i < n - x:
				p[l[i] - 1] = 1
			else:
				q[l[i] - 1] = 1
		except:
			break
	if sum(p) == n - x and sum(q) == x:
		c += 1
		a += [n - x, x]
	p = [0] * x
	q = [0] * (n - x)
	for i in range(n):
		try:
			if i < x:
				p[l[i] - 1] = 1
			else:
				q[l[i] - 1] = 1
		except:
			break
	if sum(p) == x and sum(q) == n - x:
		c += 1
		a += [x, n - x]
	print(c if c < 2 else c - int(a[0] == a[2]))
	if a != []:
		print(a[0], a[1])
		if len(a) == 4 and a[0] != a[2]:
			print(a[2], a[3])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	maxNum = max(a)
	counts = [0] * (maxNum + 1)
	for x in a:
		counts[x] += 1
	possible = True
	if counts[1] != 2:
		possible = False
	l1 = 1
	if possible:
		while l1 < len(counts) and counts[l1] == 2:
			l1 += 1
	for i in range(l1, maxNum + 1):
		if counts[i] != 1:
			possible = False
	l1 -= 1
	answers = []
	repeatCheck = set()
	if possible:
		maxTill = 0
		for (idx, i) in enumerate(a):
			if i in repeatCheck:
				break
			repeatCheck.add(i)
			maxTill = max(maxTill, i)
			if maxTill == idx + 1:
				if maxTill in [l1, maxNum]:
					answers.append((maxTill, n - maxTill))
	print(len(answers))
	for x in answers:
		print(x[0], x[1])


a = int(input())
for i in range(a):
	n = int(input())
	l = list(map(int, input().split()))
	k = max(l)
	c = []
	for i2 in {k, n - k}:
		if set(l[:i2]) == set((j + 1 for j in range(i2))) and set(l[i2:]) == set((j + 1 for j in range(n - i2))):
			c.append(i2)
	print(len(c))
	for ans in c:
		print(ans, n - ans)


for _ in range(int(input())):
	n = int(input())
	b = [int(i) for i in input().split()]
	a = [0]
	c = [0]
	ans = []
	for i in range(1, n + 1):
		a += [a[-1] + i]
		c += [c[-1] + b[i - 1]]
	used = [0 for i in range(max(b) + 1)]
	for i in range(1, n):
		if used[b[i - 1]] == 0:
			if c[i] == a[i] and c[n] - c[i] == a[n - i] and (n - i == len(set(b[i:]))):
				ans += [[i, n - i]]
			used[b[i - 1]] = 1
		else:
			break
	print(len(ans))
	for (x, y) in ans:
		print(x, y)


t = int(input())

def check_permute(a, n):
	num = set()
	for i in range(n):
		if a[i] not in num:
			num.add(a[i])
		else:
			return False
	return True
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	pref_a = [a[0]] * n
	suff_a = [a[-1]] * n
	for i in range(1, n):
		pref_a[i] = pref_a[i - 1] + a[i]
	for i in range(n - 2, -1, -1):
		suff_a[i] = suff_a[i + 1] + a[i]
	ans = []
	for i in range(n - 1):
		l1 = i + 1
		l2 = n - l1
		if pref_a[i] == l1 * (l1 + 1) // 2 and suff_a[i + 1] == l2 * (l2 + 1) // 2:
			res1 = check_permute(a[:l1], l1)
			res2 = check_permute(a[l1:], l2)
			if res1 and res2:
				ans.append([l1, l2])
	print(len(ans))
	for res in ans:
		print(res[0], res[1])


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	d = dict()
	demand = 1
	pre = [0] * n
	post = [0] * n
	for i in range(n):
		d[arr[i]] = 1
		if demand in d:
			while demand in d:
				demand += 1
			pre[i] = demand - 1
	d2 = dict()
	demand = 1
	for i in range(n - 1, -1, -1):
		d2[arr[i]] = 1
		if demand in d2:
			while demand in d2:
				demand += 1
			post[i] = demand - 1
	l = []
	for i in range(1, n):
		if post[i] + pre[i - 1] == n:
			l += [[pre[i - 1], post[i]]]
	print(len(l))
	for i in l:
		print(*i)


t = int(input())

def is_perm(s):
	st = set(s)
	for i in range(1, len(s) + 1):
		if i not in st:
			return False
	return True
for _ in range(t):
	input()
	arr = list(map(int, input().split()))
	sm = sum(arr)
	ans = list()
	left = 0
	for idx in range(len(arr) - 1):
		v = arr[idx]
		left += v
		must_left = (idx + 2) * (idx + 1) // 2
		right = sm - left
		must_right = (len(arr) - idx) * (len(arr) - idx - 1) // 2
		if must_left == left and right == must_right:
			if is_perm(arr[:idx + 1]) and is_perm(arr[idx + 1:]):
				ans.append((idx + 1, len(arr) - idx - 1))
	print(len(ans))
	for a in ans:
		print(*a)


from collections import defaultdict

def soln(arr):
	uniqueFromFront = [False for _ in arr]
	uniqueFromBack = [False for _ in arr]
	prefixSums = [0]
	going = True
	forwardTable = defaultdict(int)
	for (i, elem) in enumerate(arr):
		if elem in forwardTable:
			going = False
		elif going:
			uniqueFromFront[i] = True
		if going:
			forwardTable[elem] += 1
		prefixSums.append(prefixSums[-1] + elem)
	backwardTable = defaultdict(int)
	for i in range(len(arr) - 1, -1, -1):
		elem = arr[i]
		if elem in backwardTable:
			break
		else:
			uniqueFromBack[i] = True
		backwardTable[elem] += 1

	def rangedSum(l, r):
		return prefixSums[r + 1] - prefixSums[l]

	def ascSum(n):
		return n * (n + 1) // 2
	result = []
	for i in range(1, len(arr)):
		if uniqueFromFront[i - 1] and uniqueFromBack[i] and (rangedSum(0, i - 1) == ascSum(i)) and (rangedSum(i, len(arr) - 1) == ascSum(len(arr) - i)):
			result.append([len(arr[:i]), len(arr[i:])])
	return result

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = [int(i) for i in input().split(' ')]
		result = soln(a)
		print(len(result))
		for res in result:
			(l1, l2) = res
			print('{} {}'.format(l1, l2))

def test():
	a = [1, 4, 3, 2, 1]
	print(soln(a))
main()


import sys
input = iter(sys.stdin.readlines()).__next__
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))

	def output():
		output = []
		c1 = {}
		c2 = {}
		for (i, x) in enumerate(a):
			if x not in c1:
				c1[x] = i
			elif x not in c2:
				c2[x] = i
			else:
				return []
		(l, r) = (0, n + 1)
		for x in range(1, n + 1):
			if x in c2:
				(xl, xr) = sorted([c1[x], c2[x]])
				l = max(l, xl + 1)
				r = min(r, xr)
				if l > r:
					return []
			else:
				break
		longer = 0
		for x in range(x, n - (x - 1) + 1):
			if x not in c1:
				return []
			if x in c2:
				return []
			i = c1[x]
			if i < l:
				if longer == +1:
					return []
				longer = -1
				l = r
			elif i >= r:
				if longer == -1:
					return []
				longer = +1
				r = l
		output.append([l, n - l])
		if r > l:
			output.append([r, n - r])
		return output
	out = output()
	print(len(out))
	for r in out:
		print(*r)


t = int(input())
for jj in range(t):
	n = int(input())
	a = list(map(int, input().strip().split(' ')))
	pp = max(a)
	x1 = [0 for _ in range(pp + 1)]
	kk = 0
	for i in range(n):
		x1[a[i]] += 1
		if x1[a[i]] == 2 and kk == 0:
			ppp = i
			kk = 1
	x1 = x1[1:]
	mn1 = 0
	mn2 = 0
	ff = True
	pppp = -1
	for i in range(len(x1)):
		if x1[i] == 2:
			pppp = i
	for i in range(len(x1)):
		if x1[i] == 0 and i <= pp - 1 or pppp == -1:
			ff = False
			break
		elif x1[i] == 1 and i <= pppp:
			ff = False
			break
	if not ff:
		print(0)
	else:
		xkkk = 0
		fgh = []
		sum1 = sum(a[0:pppp + 1])
		sum2 = sum(a) - sum1
		sum3 = sum(a[n - pppp - 1:])
		sum4 = sum(a) - sum3
		if sum1 == (pppp + 1) * (pppp + 2) // 2 and sum2 == pp * (pp + 1) // 2:
			xkkk += 1
			fgh.append([pppp + 1, n - pppp - 1])
		if sum3 == (pppp + 1) * (pppp + 2) // 2 and sum4 == pp * (pp + 1) // 2:
			if n != 2 * (pppp + 1):
				fgh.append([n - pppp - 1, pppp + 1])
				xkkk += 1
		if xkkk == 0:
			print(0)
		else:
			print(xkkk)
			for jjj in fgh:
				print(jjj[0], jjj[1])


import os
import heapq
import sys, threading
import math as mt
import operator
from copy import copy
from collections import defaultdict, deque
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		ar = inpt()
		ma = max(ar)
		(tp1, tp2) = ([], [])
		if ma >= n:
			print(0)
			continue
		for i in range(ma):
			tp1.append(ar[i])
		for i in range(ma, n):
			tp2.append(ar[i])
		tp1.sort()
		tp2.sort()
		ok1 = True
		for i in range(len(tp1)):
			if tp1[i] != i + 1:
				ok1 = False
				break
		for i in range(len(tp2)):
			if tp2[i] != i + 1:
				ok1 = False
				break
		ok2 = True
		ar = ar[::-1]
		(tp1, tp2) = ([], [])
		for i in range(ma):
			tp1.append(ar[i])
		for i in range(ma, n):
			tp2.append(ar[i])
		tp1.sort()
		tp2.sort()
		for i in range(len(tp1)):
			if tp1[i] != i + 1:
				ok2 = False
				break
		for i in range(len(tp2)):
			if tp2[i] != i + 1:
				ok2 = False
				break
		if ok1 == ok2 == False:
			print(0)
			continue
		if ok1 == ok2 == True and ma != n - ma:
			print(2)
			print(n - ma, ma)
			print(ma, n - ma)
			continue
		if ok1 == True:
			print(1)
			print(ma, n - ma)
			continue
		if ok2 == True:
			print(1)
			print(n - ma, ma)
			continue
		print(0)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	mx = max(a)
	sz = n - mx
	s1 = {num for num in range(1, sz + 1)}
	s2 = {num for num in range(1, mx + 1)}
	ans = 0
	l = []
	for i in range(n):
		if i < sz:
			if a[i] in s1:
				s1.remove(a[i])
		elif a[i] in s2:
			s2.remove(a[i])
	if len(s1) == 0 and len(s2) == 0:
		ans += 1
		l.append(sz)
		l.append(mx)
	s2 = {num for num in range(1, sz + 1)}
	s1 = {num for num in range(1, mx + 1)}
	for i in range(n):
		if i < mx:
			if a[i] in s1:
				s1.remove(a[i])
		elif a[i] in s2:
			s2.remove(a[i])
	if len(s1) == 0 and len(s2) == 0 and (sz != mx):
		ans += 1
		l.append(mx)
		l.append(sz)
	if ans == 0:
		print(ans)
	else:
		print(ans)
		for i in range(0, ans * 2, 2):
			print(f'{l[i]} {l[i + 1]}')


from collections import defaultdict

def check(arr):
	arr.sort()
	value = [i + 1 for i in range(len(arr))]
	if arr == value:
		return True
	return False
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	high = max(l)
	low = len(l) - high
	ans = []
	if check(l[:low]) == True and check(l[low:]) == True:
		ans.append([low, high])
	if low != high and check(l[:high]) == True and (check(l[high:]) == True):
		ans.append([high, low])
	print(len(ans))
	for i in ans:
		print(*i)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	conc = list(map(int, input().split()))
	minp = [n] * n
	mins = [n] * (n + 1)
	maxp = [0] * n
	maxs = [0] * (n + 1)
	for i in range(n):
		minp[i] = min(minp[i - 1], conc[i])
		maxp[i] = max(maxp[i - 1], conc[i])
	for i in range(n - 1, -1, -1):
		mins[i] = min(mins[i + 1], conc[i])
		maxs[i] = max(maxs[i + 1], conc[i])
	s1 = {conc[0]}
	s2 = defaultdict(int)
	for i in range(1, n):
		s2[conc[i]] += 1
	possibles = []
	for i in range(1, n):
		pred = minp[i - 1] == 1 and mins[i] == 1 and (maxp[i - 1] == i) and (maxs[i] == n - i)
		if pred and len(s1) == i and (len(s2) == n - i):
			possibles.append(i)
		s1.add(conc[i])
		s2[conc[i]] -= 1
		if s2[conc[i]] == 0:
			s2.pop(conc[i])
	print(len(possibles))
	for pos in possibles:
		print(pos, n - pos)


import collections, math
local = False
if local:
	file = open('inputt.txt', 'r')

def inp():
	if local:
		return file.readline().rstrip()
	else:
		return input().rstrip()

def ints():
	return [int(_) for _ in inp().split()]
t = int(inp())
for _ in range(t):
	n = int(inp())
	arr = ints()
	ans = []
	right = 0
	visited = set()
	validPermu = [False] * len(arr)
	for i in range(len(arr)):
		right = max(right, arr[-i - 1])
		if arr[-i - 1] not in visited:
			visited.add(arr[-i - 1])
		else:
			break
		if i + 1 == right:
			validPermu[-i - 1] = True
	right = 0
	visited.clear()
	for i in range(len(arr)):
		right = max(right, arr[i])
		if arr[i] not in visited:
			visited.add(arr[i])
		else:
			break
		if i + 1 == right and validPermu[i + 1]:
			(first, sec) = (i + 1, len(arr) - i - 1)
			ans.append([first, sec])
	if len(ans) == 0:
		print(0)
	else:
		print(len(ans))
		for (first, sec) in ans:
			print('{0} {1}'.format(first, sec))


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	ans = []
	s1 = 0
	c = 0
	s = set([])
	s2 = sum(l)
	for i in range(n):
		s1 += l[i]
		s.add(l[i])
		t = i + 1
		p = n - t
		if t * (t + 1) // 2 == s1 and len(s) == t and (s2 - s1 == p * (p + 1) // 2):
			c += 1
			ans.append((t, p))
	ans2 = set([])
	s1 = 0
	s = set([])
	s2 = sum(l)
	k = 0
	for i in range(n - 1, -1, -1):
		s1 += l[i]
		s.add(l[i])
		t = k + 1
		p = n - t
		if t * (t + 1) // 2 == s1 and len(s) == t and (s2 - s1 == p * (p + 1) // 2):
			ans2.add((t, p))
		k += 1
	c = 0
	newans = []
	for i in ans:
		if (i[1], i[0]) in ans2:
			newans.append((i[0], i[1]))
			c += 1
	print(c)
	for i in newans:
		print(i[0], i[1])


t = int(input())
for f in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = [0] * (n + 1)
	k = 0
	m = 0
	t = 0
	s = [0]
	for i in range(n):
		x[a[i]] += 1
		if x[a[i]] == 1:
			t += 1
		m = max(m, a[i])
		if m == t and m == i + 1:
			k += 1
			s += [i + 1]
	possible = 1
	p1 = 0
	if x[1] != 2:
		possible = 0
	for i in range(n - 1):
		if x[i + 2] > x[i + 1]:
			possible = 0
		if x[i + 2] < x[i + 1] and x[i + 1] == 2:
			p1 = i + 1
	if possible == 1:
		rk = 0
		rs = [0]
		for i in range(k):
			if s[i + 1] == p1 or s[i + 1] == n - p1:
				rk += 1
				rs += [s[i + 1]]
		print(rk)
		for i in range(rk):
			print(rs[i + 1], n - rs[i + 1])
	else:
		print(0)


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
testcases = int(input())
for case in range(testcases):
	n = int(input())
	l = [int(zax) for zax in input().split()]
	total = sum(l)
	first = 0
	answers = []
	prev = 0
	for i in range(n - 1):
		prev += l[i]
		other_sum = total - prev
		count = n - i - 1
		if (i + 1) * (i + 2) // 2 == prev and count * (count + 1) // 2 == other_sum:
			p1 = l[0:i + 1]
			p2 = l[i + 1:]
			if sorted(p1) == [i for i in range(1, i + 2)] and sorted(p2) == [i for i in range(1, count + 1)]:
				first += 1
				answers.append([i + 1, count])
	print(first)
	for i in range(first):
		print(answers[i][0], answers[i][1])


import sys
import math
input = sys.stdin.readline

def solve(N, A):
	items = set()
	ans = set()
	max_item = -1
	for i in range(N):
		items.add(A[i])
		if A[i] > max_item:
			max_item = A[i]
		if len(items) == max_item and len(items) == i + 1:
			ans.add(i + 1)
	return ans
T = int(input())
for t in range(T):
	N = int(input())
	A = list(map(int, input().split(' ')))
	ans1 = solve(N, A)
	ans2 = {N - x for x in solve(N, list(reversed(A)))}
	ans = ans1 & ans2
	print(len(ans))
	for x in ans:
		print(x, N - x)


import sys
from math import sqrt, floor
from collections import deque, Counter
inp = sys.stdin.readline
read = lambda : list(map(int, inp().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		(n, x) = read()
		arr = sorted(list(set(read())))
		n = len(arr)
		i = 0
		while i < n and arr[i] <= x + 1:
			x += 1
			i += 1
		ans += str(x) + '\n'
	print(ans)

def b():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		arr = read()
		total = sum(arr)
		s1 = 0
		ans_lis = []
		for i in range(n):
			s1 += arr[i]
			total -= arr[i]
			(p1, p2) = (i + 1, n - i - 1)
			if s1 == p1 * (p1 + 1) // 2 and total == p2 * (p2 + 1) // 2 and (len(set(arr[:p1])) == p1) and (len(set(arr[p1:])) == p2):
				ans_lis.append(str(p1) + ' ' + str(p2))
		ans += str(len(ans_lis)) + '\n'
		for i in ans_lis:
			ans += str(i) + '\n'
	print(ans)
b()


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))
mo = 1000000007
d = defaultdict(int)
for i in range(1, 200001):
	res = i * (i + 1) // 2
	d[res] = i
for _ in range(inn()):
	n = inn()
	a = arr()
	sm = 0
	count = defaultdict(int)
	pre = defaultdict(int)
	flag = 0
	for i in range(n):
		sm += a[i]
		if a[i] in count:
			flag = 1
		else:
			count[a[i]] += 1
		if sm in d and i + 1 == d[sm] and (flag == 0):
			pre[i] = sm
	sm = 0
	flag = 0
	count = defaultdict(int)
	suf = defaultdict(int)
	for i in range(n - 1, -1, -1):
		sm += a[i]
		if a[i] in count:
			flag = 1
		else:
			count[a[i]] += 1
		if sm in d and n - i == d[sm] and (flag == 0):
			suf[i] = sm
	ans = []
	for i in pre:
		if i + 1 in suf:
			ans += [(d[pre[i]], d[suf[i + 1]])]
	print(len(ans))
	for i in range(len(ans)):
		print(ans[i][0], ans[i][1])


def check(sublist, length):
	if len(set(sublist)) != length:
		return False
	if max(sublist) > length:
		return False
	return True
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	result = ''
	for i in {max(a), n - max(a)}:
		if check(a[:i], i):
			if check(a[i:], n - i):
				count += 1
				result += f'{i} {n - i}\n'
	print(count)
	if result:
		result = result[:-1]
		print(result)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(p) for p in input().split()]
	m = max(arr)
	count = 0
	if sorted(arr[:m]) == list(range(1, m + 1)) and sorted(arr[m:]) == list(range(1, n - m + 1)):
		count += 1
		t = 1
	if sorted(arr[:n - m]) == list(range(1, n - m + 1)) and sorted(arr[n - m:]) == list(range(1, m + 1)):
		count += 1
		t = 2
	if count == 2:
		if n - m == m:
			print(1)
			print(n - m, m)
			continue
		print(count)
		print(n - m, m)
		print(m, n - m)
	elif count == 1:
		print(1)
		if t == 1:
			print(m, n - m)
		else:
			print(n - m, m)
	else:
		print(0)


kl = int(input())
for l in range(kl):
	n = int(input())
	mx = 0
	k = 0
	a = [0 for j in range(n)]
	for i in input().split():
		i = int(i)
		a[k] = i
		k += 1
		mx = max(mx, i)
	if mx >= n:
		print(0)
		continue
	kn1 = n - mx
	kn2 = mx
	A1 = {int(i) for i in range(1, kn1 + 1)}
	B1 = {int(i) for i in range(1, kn2 + 1)}
	A2 = {int(i) for i in range(1, kn2 + 1)}
	B2 = {int(i) for i in range(1, kn1 + 1)}
	ra1 = set()
	ra2 = set()
	rb1 = set()
	rb2 = set()
	for i in range(kn1):
		ra1.add(a[i])
	for i in range(kn1, n):
		rb1.add(a[i])
	for i in range(kn2):
		ra2.add(a[i])
	for i in range(kn2, n):
		rb2.add(a[i])
	if A1 == ra1 and rb1 == B1:
		if A2 == ra2 and B2 == rb2:
			if kn1 == kn2:
				print(1)
				print(kn1, kn2)
			else:
				print(2)
				print(kn1, kn2)
				print(kn2, kn1)
		else:
			print(1)
			print(kn1, kn2)
	elif A2 == ra2 and B2 == rb2:
		print(1)
		print(kn2, kn1)
	else:
		print(0)


ans = []
for _ in range(int(input())):
	n = int(input())
	u = list(map(lambda x: int(x) - 1, input().split()))
	mm = max(u) + 1
	d = []
	for i in range(mm):
		d.append([])
	for i in range(n):
		d[u[i]].append(i)
	ok = False
	okk = False
	for i in range(mm):
		if len(d[i]) == 0 or len(d[i]) > 2:
			ans.append('0')
			okk = True
			break
		if not ok:
			if len(d[i]) == 1:
				ok = True
		elif len(d[i]) == 2:
			ans.append('0')
			okk = True
			break
	if okk:
		continue
	w = []
	w.append((-1, 1))
	w.append((n, -1))
	for i in range(mm):
		if len(d[i]) == 1:
			break
		w.append((d[i][0], 1))
		w.append((d[i][1], -1))
	w.sort()
	st = 0
	a = -1
	b = -1
	for i in range(len(w)):
		st += w[i][1]
		if st == len(w) // 2:
			a = w[i][0]
		if st == len(w) // 2 - 1 and a != -1:
			b = w[i][0]
			break
	mn = n
	mx = -1
	for i in range(len(w) // 2 - 1, mm):
		mn = min(mn, d[i][0])
		mx = max(mx, d[i][0])
	if mx == -1:
		mn = -1
	p1 = (-1, mn)
	p2 = (mx, n)
	ansi = []
	if a < mn:
		for i in range(a, min(b, mn)):
			ansi.append((i + 1, n - i - 1))
	if mx < b:
		for i in range(max(mx, a), b):
			ansi.append((i + 1, n - i - 1))
	ans.append(str(len(ansi)))
	for i in range(len(ansi)):
		ans.append(str(ansi[i][0]) + ' ' + str(ansi[i][1]))
print('\n'.join(ans))


import sys
input = sys.stdin.buffer.readline
T = int(input())
for t in range(1, T + 1):
	L = int(input())
	W = [int(x) for x in input().split()]
	m = max(W)
	answer = []
	if set(W[:m]) == set(range(1, m + 1)) and set(W[m:]) == set(range(1, L - m + 1)):
		answer.append(m)
	m = L - m
	if set(W[:m]) == set(range(1, m + 1)) and set(W[m:]) == set(range(1, L - m + 1)):
		answer.append(m)
	answer = set(answer)
	print(len(answer))
	for a in answer:
		print('{} {}'.format(a, L - a))


t = int(input())
for T in range(t):
	n = int(input())
	v = [int(i) for i in input().split(' ')]
	s = sorted(v)
	l1 = 0
	for i in range(1, n):
		if s[i] == s[i - 1]:
			l1 = s[i]
	l2 = s[-1]
	if l1 + l2 != n:
		print(0)
		continue
	ans = []
	f1 = set(v[:l1])
	f2 = set(v[l1:])
	if len(f1) == l1 and len(f2) == l2:
		ans.append((l1, l2))
	s1 = set(v[:l2])
	s2 = set(v[l2:])
	if l1 != l2 and len(s2) == l1 and (len(s1) == l2):
		ans.append((l2, l1))
	print(len(ans))
	for i in ans:
		print(i[0], i[1])


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	l = li()
	a = set()
	s = Counter(l)
	b = set(l)
	le1 = 0
	le2 = sum(s.values())
	m = 0
	ind = n
	lmax = [0]
	for i in l[::-1]:
		lmax.append(max(lmax[-1], i))
	lmax = lmax[1:]
	lmax = lmax[::-1]
	lmax = lmax[1:]
	lsmall = [0]
	for i in l:
		lsmall.append(max(lsmall[-1], i))
	lsmall = lsmall[1:]
	ans = []
	for j in range(n):
		if l[j] in a:
			break
		a.add(l[j])
		le1 += 1
		s[l[j]] -= 1
		if not s[l[j]]:
			b.remove(l[j])
		le2 -= 1
		if le1 == lsmall[j] and le2 == len(b) == lmax[j]:
			ans.append([le1, len(b)])
	print(len(ans))
	for i in ans:
		print(*i)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	flag = 1
	first = 0
	out = 0
	mem = [0] * n
	for i in a:
		mem[i - 1] += 1
		if mem[i - 1] > 2:
			flag = 0
			break
	for i in mem:
		if i == 2:
			first += 1
		else:
			break
	if flag and first and (first <= n):
		sec = n - first
		f = a[:first]
		s = a[first:]
		res = []
		check1 = list(range(1, first + 1))
		check2 = list(range(1, sec + 1))
		if check1 == list(set(f)) and check2 == list(set(s)):
			out = 1
			res.append([first, sec])
		f = a[:sec]
		s = a[sec:]
		if check2 == list(set(f)) and check1 == list(set(s)) and (first != sec):
			out += 1
			res.append([sec, first])
		print(out)
		for i in res:
			print(*i)
	else:
		print(out)


import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict
from collections import deque
from functools import cmp_to_key
import math

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def solve(c1, c2, maxi1, maxi2):
	for i in range(1, maxi1 + 1):
		if i not in c1:
			return False
	for i in range(1, maxi2 + 1):
		if i not in c2:
			return False
	return True

def main():
	for _ in range(iin()):
		n = iin()
		l = ain()
		maxi = max(l)
		ans = []
		c1 = Counter(l[0:maxi])
		c2 = Counter(l[maxi:])
		if solve(c1, c2, maxi, n - maxi):
			ans.append(maxi)
		c1 = Counter(l[n - maxi:])
		c2 = Counter(l[:n - maxi])
		if solve(c1, c2, maxi, n - maxi):
			ans.append(n - maxi)
		ans = set(ans)
		print(len(ans))
		for i in ans:
			print(i, n - i)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin
from collections import Counter
t = int(input())
for _ in range(t):
	(n,) = map(int, stdin.readline().split())
	S = list(map(int, stdin.readline().split()))
	M = 1
	rtbs = 1
	c = Counter()
	forward = [False] * n
	for i in range(n):
		if c[S[i]] > 0:
			break
		else:
			c[S[i]] += 1
		if S[i] > M:
			M = S[i]
			rtbs = M - i - 1
		else:
			rtbs -= 1
		if rtbs == 0:
			forward[i] = True
	M = 1
	rtbs = 1
	c = Counter()
	backward = [False] * n
	S = S[::-1]
	for i in range(n):
		if c[S[i]] > 0:
			break
		else:
			c[S[i]] += 1
		if S[i] > M:
			M = S[i]
			rtbs = M - i - 1
		else:
			rtbs -= 1
		if rtbs == 0:
			backward[i] = True
	backward = backward[::-1]
	count = 0
	ans = []
	for i in range(n - 1):
		if forward[i] and backward[i + 1]:
			count += 1
			ans.append(str(i + 1) + ' ' + str(n - i - 1))
	print(count)
	for i in ans:
		print(i)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	c = 0
	ans = ''
	a = [s[0]] + [0] * n
	b = [0] + s[1:]
	mxa = max(a)
	mxb = max(b)
	sa = {}
	sb = {}
	sa[mxa] = 1
	for i in range(1, n):
		if sb.get(b[i]):
			sb[b[i]] += 1
		else:
			sb[b[i]] = 1
	mxsbind = -1
	for i in range(1, n):
		if len(sa) == mxa == i and len(sb) == mxb == n - i:
			c += 1
			ans += str(i) + ' ' + str(n - i) + '\n'
		t = b[i]
		b[i] = 0
		sb[t] -= 1
		if sb[t] == 0:
			sb.pop(t)
			if t == mxb:
				for j in range(mxb - 1, -1, -1):
					if sb.get(j):
						mxb = j
						break
		if sa.get(t):
			sa[t] += 1
		else:
			sa[t] = 1
		a[i] = t
		mxa = max(mxa, t)
	print(c)
	if c:
		print(ans[:-1])


MAX_N = 200010
T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	c = {}
	ans = []
	maxl = 1
	for i in range(n):
		x = a[i]
		maxl = max(x, maxl)
		if x in c:
			c[x] += 1
		else:
			c[x] = 1
	perm = True
	for i in range(1, maxl + 1):
		if i not in c or c[i] == 0 or c[i] > 2:
			perm = False
			break
	if perm:
		for i in range(1, maxl + 1):
			if c[i] == 2:
				if i == maxl:
					minl = i
				elif c[i + 1] == 1:
					minl = i
					break
	if perm:
		for i in range(minl + 1, maxl + 1):
			if c[i] != 1:
				perm = False
				break
	if perm:
		for p in set([minl - 1, maxl - 1]):
			valid = True
			v1 = set()
			v2 = set()
			for j in range(p + 1):
				v1.add(a[j])
			for j in range(p + 1, n):
				v2.add(a[j])
			for j in range(1, p + 1 + 1):
				if j not in v1:
					valid = False
					break
			if valid:
				for j in range(1, n - (p + 1) + 1):
					if j not in v2:
						valid = False
						break
			if valid:
				ans.append((p + 1, n - (p + 1)))
	print(len(ans))
	for i in range(len(ans)):
		(l1, l2) = ans[i]
		print(l1, l2)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	temp = [0 for i in range(n + 1)]
	count = 0
	flag = ''
	for i in range(n):
		temp[a[i]] += 1
		if temp[a[i]] == 2:
			count += 1
		if temp[a[i]] == 3:
			flag = 'not possible'
	for i in range(1, n - count + 1):
		if temp[i] == 0:
			flag = 'not possible'
		if i > count and temp[i] == 2:
			flag = 'not possible'
		if i <= count and temp[i] != 2:
			flag = 'not possible'
	if flag == '':
		target = count * (count + 1) // 2
		temp1 = 0
		for i in range(count):
			temp1 += a[i]
		temp2 = 0
		for i in range(n - 1, n - count - 1, -1):
			temp2 += a[i]
		if temp1 == temp2 and temp1 == target:
			if count == n - count:
				print(1)
				print(count, count)
			else:
				print(2)
				print(count, n - count)
				print(n - count, count)
		elif temp1 == target and temp2 != target:
			print(1)
			print(count, n - count)
		elif temp2 == target and temp1 != target:
			print(1)
			print(n - count, count)
		else:
			print(0)
	else:
		print(0)


from collections import defaultdict
t = int(input())
for k in range(t):
	n = int(input())
	a = [int(el) for el in input().split()]
	pref_sum = [0 for i in range(n)]
	pref_sum[0] = a[0]
	numbers = defaultdict(int)
	numbers[a[0]] = 1
	for i in range(1, n):
		pref_sum[i] = pref_sum[i - 1] + a[i]
		numbers[a[i]] += 1
	max_r = [0 for i in range(n)]
	max_r[n - 1] = a[n - 1]
	for i in range(n - 2, -1, -1):
		max_r[i] = max(max_r[i + 1], a[i])
	result = []
	max_l = 0
	num_l = defaultdict(int)
	for i in range(n - 1):
		num_l[a[i]] += 1
		if num_l[a[i]] > 1:
			break
		numbers[a[i]] -= 1
		if numbers[a[i]] == 0:
			numbers.pop(a[i])
		max_l = max(max_l, a[i])
		len_r = n - i - 1
		if i + 1 != len(num_l) or len_r != len(numbers):
			continue
		if max_l != i + 1 or max_r[i + 1] != len_r:
			continue
		if pref_sum[i] == (1 + i + 1) * (i + 1) // 2 and pref_sum[n - 1] - pref_sum[i] == (1 + len_r) * len_r // 2:
			result.append((i + 1, len_r))
	print(len(result))
	for (l, r) in result:
		print(l, r)


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, A):

	def makeForward(A):
		seen = set()
		mn = float('inf')
		mx = float('-inf')
		bad = False
		forward = []
		for (i, x) in enumerate(A):
			mx = max(mx, x)
			mn = min(mn, x)
			if x in seen:
				bad = True
			seen.add(x)
			if bad:
				forward.append(False)
			else:
				forward.append(i + 1 == len(seen) and mn == 1 and (mx == i + 1))
		return forward
	forward = makeForward(A)
	backward = makeForward(A[::-1])
	ans = []
	for l1 in range(1, N):
		l2 = N - l1
		if forward[l1 - 1] and backward[l2 - 1]:
			ans.append(str(l1) + ' ' + str(l2))
	if ans:
		return str(len(ans)) + '\n' + '\n'.join(ans)
	return 0
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N,) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, A)
	print(ans)


from bisect import bisect_left, bisect_right
from sys import stdin, stdout, setrecursionlimit
from collections import Counter
input = lambda : stdin.readline().strip()
print = stdout.write
t = int(input())
for _ in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	forward = []
	backward = []
	for i in range(n + 1):
		forward.append(False)
		backward.append(False)
	m = 1
	d = []
	for i in range(n + 1):
		d.append(False)
	for i in range(n):
		if d[ls[i]]:
			break
		d[ls[i]] = True
		if ls[i] == m:
			m += 1
			while d[m]:
				m += 1
		if m == i + 2:
			forward[i] = True
	m = 1
	d = []
	for i in range(n + 1):
		d.append(False)
	for i in range(n - 1, -1, -1):
		if d[ls[i]]:
			break
		d[ls[i]] = True
		if ls[i] == m:
			m += 1
			while d[m]:
				m += 1
		if m == len(ls) - i + 1:
			backward[i] = True
	soln = []
	for i in range(n - 1):
		if forward[i] and backward[i + 1]:
			soln.append((i + 1, n - i - 1))
	print(str(len(soln)) + '\n')
	for i in soln:
		print(str(i[0]) + ' ' + str(i[1]) + '\n')


t = int(input())
for q in range(t):
	n = int(input())
	li = list(map(int, input().split(' ', n)[:n]))
	m = max(li)
	hs = [0] * (m + 1)
	ans = 0
	an = set([])
	fl = 0
	for i in range(m):
		hs[li[i]] += 1
		if hs[li[i]] != 1:
			fl = 1
			break
	if fl == 0:
		hs = [0] * (m + 1)
		for i in range(m, n):
			hs[li[i]] += 1
		for i in range(1, n - m + 1):
			if hs[i] != 1:
				fl = 1
				break
		if fl == 0:
			ans += 1
			an.add((m, n - m))
	li.reverse()
	hs = [0] * (m + 1)
	fl = 0
	for i in range(m):
		hs[li[i]] += 1
		if hs[li[i]] != 1:
			fl = 1
			break
	if fl == 0:
		hs = [0] * (m + 1)
		for i in range(m, n):
			hs[li[i]] += 1
		for i in range(1, n - m + 1):
			if hs[i] != 1:
				fl = 1
				break
		if fl == 0:
			ans += 1
			an.add((n - m, m))
	print(len(an))
	li = []
	for i in an:
		li.append([i[0], i[1]])
	li.sort()
	for i in li:
		print(i[0], i[1])


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	l1 = max(arr)
	ans = []
	for j in range(2):
		if set(arr[:l1]) == set(range(1, l1 + 1)) and set(arr[l1:]) == set(range(1, n - l1 + 1)):
			ans.append(l1)
		l1 = n - l1
	ans = set(ans)
	print(len(ans))
	for i in ans:
		print(i, n - i)


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	mx = max(arr)
	i = mx
	d = []
	for j in range(2):
		if set(arr[:i]) == set(range(1, i + 1)) and set(arr[i:]) == set(range(1, n - i + 1)):
			d.append(i)
		i = n - i
	d = set(d)
	print(len(d))
	if len(d) > 0:
		for i in d:
			print(i, n - i)


z = input
for _ in range(int(z())):
	n = int(z())
	l = list(map(int, z().split()))
	(l1, k, c) = ([], max(l), 0)
	for i in {k, n - k}:
		if set(l[:i]) == set(range(1, i + 1)) and set(l[i:]) == set(range(1, n - i + 1)):
			l1.append(i)
			c += 1
	print(c)
	for i in l1:
		print(i, n - i)


import sys, re, math
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest

def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST():
	return list(map(int, input().split()))

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def sortListWithIndex(listOfTuples, idx):
	return sorted(listOfTuples, key=lambda x: x[idx])

def sortDictWithVal(passedDic):
	temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))[::-1]
	toret = {}
	for tup in temp:
		toret[tup[0]] = tup[1]
	return toret

def sortDictWithKey(passedDic):
	return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def check(idx):
	temp1 = [0] * (idx + 1)
	temp2 = [0] * (n - idx - 1)
	try:
		for i in range(idx + 1):
			temp1[a[i] - 1] = 1
		for i in range(idx + 1, n):
			temp2[a[i] - 1] = 1
		if sum(temp1) == idx + 1 and sum(temp2) == n - idx - 1:
			return True
		return False
	except:
		return False
t = INT()
while t != 0:
	n = INT()
	a = LIST()
	occ = defaultdict(int)
	for el in a:
		occ[el] += 1
	flag = 0
	newOcc = sortDictWithKey(occ)
	tocheck = -1
	for (i, key) in enumerate(newOcc):
		if newOcc[key] == 1:
			tocheck = i - 1
			break
	if tocheck != -1:
		z1 = check(tocheck)
		z2 = check(n - tocheck - 2)
		if z1 and z2:
			print(2)
			print(tocheck + 1, n - tocheck - 1)
			print(n - tocheck - 1, tocheck + 1)
		elif z1:
			print(1)
			print(tocheck + 1, n - tocheck - 1)
		elif z2:
			print(1)
			print(n - tocheck - 1, tocheck + 1)
		else:
			print(0)
	elif 1 not in newOcc or newOcc[1] == 1:
		print(0)
	else:
		tocheck = n // 2 - 1
		z1 = check(tocheck)
		if z1:
			print(1)
			print(tocheck + 1, n - tocheck - 1)
		else:
			print(0)
	t -= 1


import sys
input = sys.stdin.readline
from math import *
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(p) for p in input().split()]
	b = [0 for i in range(n + 1)]
	m = 1
	d = []
	if a.count(1) != 2:
		print(0)
		continue
	l = [0 for i in range(n + 1)]
	for i in range(n):
		b[a[i]] += 1
		if a[i] == m:
			while m <= n and b[m] != 0:
				m += 1
		l[i] = m
	b = [0 for i in range(n + 1)]
	r = [0 for i in range(n + 1)]
	m = 1
	a = a[::-1]
	for i in range(n):
		b[a[i]] += 1
		if a[i] == m:
			while m <= n and b[m] != 0:
				m += 1
		r[i] = m
	for i in range(n):
		if l[i] == i + 2 and r[n - i - 2] == n - i:
			d.append([i + 1, n - i - 1])
	print(len(d))
	for i in d:
		print(*i)


import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	pre = [0] * n
	suf = [0] * n
	s1 = set()
	s2 = set()
	mex1 = 0
	mex2 = 0
	s1.add(0)
	s2.add(0)
	for i in range(n):
		s1.add(a[i])
		while mex1 in s1:
			mex1 += 1
		pre[i] = mex1
	for i in range(n - 1, -1, -1):
		s2.add(a[i])
		while mex2 in s2:
			mex2 += 1
		suf[i] = mex2
	k = 0
	ans = []
	for i in range(n - 1):
		if pre[i] - 1 == i + 1 and suf[i + 1] - 1 == n - i - 1:
			k += 1
			ans.append([i + 1, n - i - 1])
	print(k)
	for i in ans:
		print(' '.join(map(str, i)))


t = int(input())

def pmok(aa):
	seen = set()
	cursum = 0
	ret = []
	for (i, a) in enumerate(aa, 1):
		if a in seen:
			break
		seen.add(a)
		cursum += a
		if cursum == i * (i + 1) // 2:
			ret.append(i)
	return ret
anss = []
for _ in range(t):
	n = int(input())
	aa = list(map(int, input().split()))
	ans = []
	sl2 = set(pmok(reversed(aa[1:])))
	for l1 in pmok(aa[:-1]):
		if n - l1 in sl2:
			ans.append(f'{l1} {n - l1}')
	anss.append(str(len(ans)))
	if ans:
		anss.append('\n'.join(ans))
print('\n'.join(anss))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	z = [0 for j in range(n - 1)]
	x = [0 for j in range(n - 1)]
	flage = 1
	falge1 = 1
	for i in range(n):
		if z[a[i] - 1] == 0:
			z[a[i] - 1] = 1
		else:
			flage1 = 0
			l = a[:i]
			m = a[i:]
			break
	a = a[::-1]
	for k in range(n):
		if x[a[k] - 1] == 0:
			x[a[k] - 1] = 1
		else:
			flage = 0
			g = a[:k]
			h = a[k:]
			break
	if flage and flage1:
		print(0)
		break
	acc1 = 0
	if flage == 0:
		if len(g) == 1:
			if g[0] == 1:
				flag1 = 1
			else:
				flag1 = 0
		else:
			g.sort()
			if g[0] != 1:
				flag1 = 0
			else:
				for j in range(1, k):
					if g[j] - g[j - 1] == 1:
						flag1 = 1
						continue
					else:
						flag1 = 0
						break
		if len(h) == 1:
			if h[0] == 1:
				flag = 1
			else:
				flag = 0
		else:
			h.sort()
			if h[0] != 1:
				flag = 0
			else:
				for j in range(1, n - k):
					if h[j] - h[j - 1] == 1:
						flag = 1
						continue
					else:
						flag = 0
						break
		if flag and flag1:
			acc1 = 1
	acc2 = 0
	if flage1 == 0:
		if len(l) == 1:
			if l[0] == 1:
				flag1a = 1
			else:
				flag1a = 0
		else:
			l.sort()
			if l[0] != 1:
				flag1a = 0
			else:
				for j in range(1, i):
					if l[j] - l[j - 1] == 1:
						flag1a = 1
						continue
					else:
						flag1a = 0
						break
		if len(m) == 1:
			if m[0] == 1:
				flaga = 1
			else:
				flaga = 0
		else:
			m.sort()
			if m[0] != 1:
				flaga = 0
			else:
				for j in range(1, n - i):
					if m[j] - m[j - 1] == 1:
						flaga = 1
						continue
					else:
						flaga = 0
						break
		if flaga and flag1a:
			acc2 = 1
	if flag and flag1 and flaga and flag1a and (n - k == i):
		print(1)
		print(n - k, k)
	else:
		print(acc1 + acc2)
		if flag and flag1:
			print(n - k, k)
		if flaga and flag1a:
			print(i, n - i)


for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	mx = [0] * n
	mn = [0] * n
	c = [0] * (n + 2)
	a = 1
	for i in range(n):
		c[ar[i]] += 1
		if c[ar[i]] > 1:
			break
		while a < n + 1:
			if c[a] == 0:
				break
			a += 1
		mn[i] = a
	temp = 0
	for i in range(n):
		if temp < ar[i]:
			temp = ar[i]
		mx[i] = temp + 1
	mx1 = [0] * n
	mn1 = [0] * n
	c1 = [0] * (n + 2)
	a = 1
	ar = ar[::-1]
	for i in range(n):
		c1[ar[i]] += 1
		if c1[ar[i]] > 1:
			break
		while a < n + 1:
			if c1[a] == 0:
				break
			a += 1
		mn1[i] = a
	temp = 0
	for i in range(n):
		if temp < ar[i]:
			temp = ar[i]
		mx1[i] = temp + 1
	mx1 = mx1[::-1]
	mn1 = mn1[::-1]
	ans = []
	for i in range(n - 1):
		if mx[i] == mn[i] and mx1[i + 1] == mn1[i + 1]:
			ans.append([i + 1, n - i - 1])
	print(len(ans))
	if len(ans) > 0:
		for i in range(len(ans)):
			print(*ans[i])


import sys
input = sys.stdin.readline
testcaseNum = int(input())
for testcase in range(testcaseNum):
	n = int(input())
	a = list(map(int, input().split()))
	front = [False] * n
	used = [False] * n
	mi = n
	ma = -1
	for i in range(n):
		if used[a[i]]:
			break
		used[a[i]] = True
		if a[i] < mi:
			mi = a[i]
		if a[i] > ma:
			ma = a[i]
		if mi == 1 and ma == i + 1:
			front[i] = True
	back = [False] * n
	used = [False] * n
	mi = n
	ma = -1
	for i in range(n - 1, -1, -1):
		if used[a[i]]:
			break
		used[a[i]] = True
		if a[i] < mi:
			mi = a[i]
		if a[i] > ma:
			ma = a[i]
		if mi == 1 and ma == n - i:
			back[i] = True
	res = []
	for i in range(n - 1):
		if front[i] and back[i + 1]:
			res.append(i + 1)
	print(len(res))
	for e in res:
		print(e, n - e)


def get():
	return int(input())
t = get()
while t > 0:
	n = get()
	a = list(map(int, input().split()))
	sum = 0
	s = set()
	s2 = set()
	mp = dict()
	for i in a:
		mp[i] = 0
	for i in a:
		sum += i
		mp[i] = mp[i] + 1
		s2.add(i)
	x = 0
	ans = []
	for i in a:
		s.add(i)
		x += i
		y = len(s)
		mp[i] = mp[i] - 1
		if mp[i] == 0:
			s2.remove(i)
		if y * (y + 1) / 2 == x:
			y = len(s2)
			if y * (y + 1) / 2 == sum - x:
				ans.append([n - y, y])
	print(len(ans))
	for i in ans:
		print(f'{i[0]} {i[1]}')
	t = t - 1


class Seq:

	def __init__(self):
		self.max = 0
		self.count = 0

	def add(self, v):
		self.max = max(v, self.max)
		self.count += 1

	def __bool__(self):
		return self.max == self.count

def tsk():
	n = int(input())
	orig = list(map(int, input().split()))
	p2 = dict()
	e1 = 0
	for i in range(n):
		if orig[i] in p2.keys():
			e1 = i + 1
			p2[orig[i]] += 1
			break
		else:
			p2[orig[i]] = 1
	for i in range(e1 + 1, n):
		if orig[i] in p2.keys():
			p2[orig[i]] += 1
		else:
			p2[orig[i]] = 1
		if p2[orig[i]] > 2:
			print(0)
			return
	L = set()
	s1 = Seq()
	for i in range(e1):
		s1.add(orig[i])
		if s1:
			L.add(i + 1)
	e2 = n - 1
	p2 = set()
	s2 = Seq()
	for i in range(n - 1, -1, -1):
		if orig[i] in p2:
			e2 = i
			break
		p2.add(orig[i])
		s2.add(orig[i])
		if not s2:
			L.discard(i)
	LC = []
	for l in L:
		if e2 < l < e1:
			LC.append(l)
	print(len(LC))
	for l in LC:
		print(l, n - l)
t = int(input())
for _ in range(t):
	tsk()


from sys import stdin
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline()

def create_z(s):
	z = [0] * len(s)
	x = y = 0
	for i in range(1, len(s)):
		z[i] = max(0, min(z[i - x], y - i + 1))
		while i + z[i] < len(s) and s[z[i]] == s[i + z[i]]:
			x = i
			y = i + z[i]
			z[i] += 1
	return z
for _ in range(ii()):
	n = ii()
	s = li()
	a = [s[0]]
	for i in range(1, n):
		a.append(a[i - 1] + s[i])
	res = []
	for i in range(1, n):
		if a[i - 1] == i * (i + 1) // 2 and a[-1] - a[i - 1] == (n - i) * (n - i + 1) // 2:
			res.append([i, n - i])
	ans = []
	for i in res:
		if sorted(s[:i[0]]) == [z for z in range(1, i[0] + 1)] and sorted(s[i[0]:]) == [z for z in range(1, 1 + i[1])]:
			ans.append(i)
	print(len(ans))
	for i in ans:
		print(*i)


from sys import stdin
input = stdin.readline
T = int(input())
for _ in range(T):
	(n, p) = (int(input()), list(map(int, input().split())))
	(la, ra) = ([0] * n, [0] * n)
	(lS, rS) = (set(), set())
	(lmx, rmx) = (0, 0)
	for i in range(n):
		lS.add(p[i])
		lmx = max(lmx, p[i])
		rS.add(p[n - i - 1])
		rmx = max(rmx, p[n - i - 1])
		if len(lS) == i + 1 and lmx == i + 1:
			la[i] = 1
		if len(rS) == i + 1 and rmx == i + 1:
			ra[n - i - 1] = 1
	res = []
	for i in range(1, n):
		if la[i - 1] and ra[i]:
			res.append(i)
	print(len(res))
	for u in res:
		print(u, n - u)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	n = int(input())
	ints = list(map(int, input().split()))
	counts = [0 for k in range(max(ints))]
	for h in range(n):
		counts[ints[h] - 1] += 1
	highestsofar = 0
	indexhigh = 0
	for s in range(len(counts)):
		if counts[s] == 2:
			indexhigh = s
	highest = indexhigh + 1
	checker = 0
	output1 = []
	output2 = []
	same = False
	if max(ints) == highest:
		same = True
	if sorted(ints[0:highest]) == list(range(1, highest + 1)) and sorted(ints[highest:]) == list(range(1, max(ints) + 1)):
		checker += 1
		output1 += [str(highest), str(max(ints))]
	if sorted(ints[0:max(ints)]) == list(range(1, max(ints) + 1)) and sorted(ints[max(ints):]) == list(range(1, highest + 1)):
		checker += 1
		output2 += [str(max(ints)), str(highest)]
	if checker == 0:
		print(0)
	elif checker == 1:
		print(1)
		if len(output1) != 0:
			print(' '.join(output1))
		if len(output2) != 0:
			print(' '.join(output2))
	elif checker == 2 and same == False:
		print(2)
		if len(output1) != 0:
			print(' '.join(output1))
		if len(output2) != 0:
			print(' '.join(output2))
	elif checker == 2 and same == True:
		print(1)
		print(' '.join(output1))


t = int(input())
for _ in range(t):
	n = int(input())
	ary = list(map(int, input().split()))
	v = 1
	z = 0
	h = 0
	arys = sorted(ary)
	arys1 = sorted(ary[:arys[n - 1]])
	arys2 = sorted(ary[arys[n - 1]:])
	for i in range(1, n - arys[n - 1] + 1):
		if arys2[i - 1] != i:
			z += 1
			break
	if z != 1:
		for i in range(1, arys[n - 1] + 1):
			if arys1[i - 1] != i:
				z += 1
				break
	arys1 = sorted(ary[:n - arys[n - 1]])
	arys2 = sorted(ary[n - arys[n - 1]:])
	for i in range(1, arys[n - 1] + 1):
		if arys2[i - 1] != i:
			h += 1
			break
	if h != 1:
		for i in range(1, n - arys[n - 1] + 1):
			if arys1[i - 1] != i:
				h += 1
				break
	if z == 1 and h == 1:
		print('0')
	elif z == 1 and h == 0:
		print('1')
		print(n - arys[n - 1], arys[n - 1])
	elif z == 0 and h == 1:
		print('1')
		print(arys[n - 1], n - arys[n - 1])
	elif z == 0 and h == 0:
		if n - arys[n - 1] == arys[n - 1]:
			print('1')
			print(n - arys[n - 1], arys[n - 1])
		else:
			print('2')
			print(n - arys[n - 1], arys[n - 1])
			print(arys[n - 1], n - arys[n - 1])


def check1(a, m, n):
	ct = [0] * m
	f = 0
	for i in range(m):
		if a[i] > m:
			f = 1
			break
		ct[a[i] - 1] += 1
		if ct[a[i] - 1] != 1:
			f = 1
			break
	for i in ct:
		if i != 1:
			f = 1
			break
	if f == 1:
		return 0
	f = 0
	ct = [0] * max(a)
	for i in range(m, len(a)):
		ct[a[i] - 1] += 1
		if ct[a[i] - 1] != 1:
			f = 1
			break
	for i in ct:
		if i != 1:
			f = 1
			break
	if f == 1:
		return 0
	return 1

def check2(a, m, n):
	ct = [0] * n
	f = 0
	for i in range(m, len(a)):
		if a[i] > n:
			f = 1
			break
		ct[a[i] - 1] += 1
		if ct[a[i] - 1] != 1:
			f = 1
			break
	for i in ct:
		if i != 1:
			f = 1
			break
	if f == 1:
		return 0
	ct = [0] * max(a)
	for i in range(m):
		ct[a[i] - 1] += 1
		if ct[a[i] - 1] != 1:
			f = 1
			break
	for i in ct:
		if i != 1:
			f = 1
			break
	if f == 1:
		return 0
	return 1
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	count = [0] * max(a)
	for j in range(n):
		count[a[j] - 1] += 1
	m = 0
	while m < len(count) and count[m] == 2:
		m += 1
	flag = 0
	for j in range(m, len(count)):
		if count[j] != 1:
			flag = 1
			break
	if flag == 1:
		print(0)
	elif m == 0:
		print(0)
	else:
		a0 = check1(a, m, len(count))
		b = check2(a, len(count), m)
		if a0 == 1 and b == 1 and (m != len(count)):
			print(2)
			print(m, len(count))
			print(len(count), m)
		elif a0 == 1:
			print(1)
			print(m, len(count))
		elif b == 1:
			print(1)
			print(len(count), m)
		elif a0 == 0 and b == 0:
			print(0)


def create_farr():
	mx = max(arr)
	carr = [0 for _ in range(mx)]
	farr = []
	fm = 1
	for (i, x) in enumerate(arr):
		carr[x - 1] += 1
		if carr[x - 1] == 2:
			while len(farr) < n:
				farr.append(False)
			break
		if fm == x:
			for j in range(fm, mx + 1):
				if j == mx or not carr[j]:
					fm = j + 1
					break
		if fm > i + 1:
			farr.append(fm - 1)
		else:
			farr.append(False)
	return farr

def create_barr():
	mx = max(arr)
	carr = [0 for _ in range(mx)]
	barr = []
	fm = 1
	for (i, x) in enumerate(reversed(arr)):
		carr[x - 1] += 1
		if carr[x - 1] == 2:
			while len(barr) < n:
				barr.append(False)
			break
		if fm == x:
			for j in range(fm, mx + 1):
				if j == mx or not carr[j]:
					fm = j + 1
					break
		if fm > i + 1:
			barr.append(fm - 1)
		else:
			barr.append(False)
	return list(reversed(barr))
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	farr = create_farr()
	barr = create_barr()
	coll = []
	for i in range(n - 1):
		if farr[i] and barr[i + 1]:
			coll.append((farr[i], barr[i + 1]))
	print(len(coll))
	for t in coll:
		print(*t)


t = int(input())
from heapq import heappush as pu
from heapq import heappop as po
for _ in range(t):
	n = int(input())
	a = [0] + list(map(int, input().split()))
	c = [False for i in range(n + 1)]
	an = []
	tr = set()
	d = []
	for i in range(1, n + 1):
		pu(d, a[i])
		while d:
			x = po(d)
			if x <= i:
				tr.add(x)
			else:
				pu(d, x)
				break
		if len(tr) == i:
			c[i] = True
	cc = [False for i in range(n + 1)]
	an = []
	tr = set()
	d = []
	for i in range(n, 0, -1):
		j = n + 1 - i
		pu(d, a[i])
		while d:
			x = po(d)
			if x <= j:
				tr.add(x)
			else:
				pu(d, x)
				break
		if len(tr) == j:
			cc[i] = True
	for i in range(1, n):
		if c[i] and cc[i + 1]:
			an.append((i, n - i))
	print(len(an))
	for i in an:
		print(*i)


def disp(a):
	for i in range(len(a)):
		print(a[i], end=' ')
	print()
t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	setf = set(a)
	count = 0
	ans = [[]]
	eh = max(a)
	he = len(a) - len(setf)
	for i in range(1, n):
		if i != eh and i != he:
			continue
		temp = a[:i]
		temp2 = a[i:]
		set1 = set(temp)
		set2 = set(temp2)
		if len(set1) != len(temp) or len(set2) != len(temp2):
			continue
		if max(temp) == i and max(temp2) == n - i:
			count += 1
			ans.append([len(temp), len(temp2)])
	print(count)
	num = 0
	for i in ans:
		if num > 0:
			print(i[0], end=' ')
			print(i[1])
		num += 1


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mp = Counter(a)
	maxi = -1
	fr = [0] * n
	lst = [0] * n
	fr[0] = a[0]
	lst[n - 1] = a[n - 1]
	for i in range(1, n):
		if fr[i - 1] < a[i]:
			fr[i] = a[i]
		else:
			fr[i] = fr[i - 1]
	for i in range(n - 2, -1, -1):
		if lst[i + 1] > a[i]:
			lst[i] = lst[i + 1]
		else:
			lst[i] = a[i]
	ls = set(mp.keys())
	fs = set()
	path = []
	count = 0
	for i in range(n):
		fs.add(a[i])
		if mp[a[i]] == 1:
			ls.remove(a[i])
		if len(fs) == fr[i] and i + 1 == fr[i]:
			if len(ls) == lst[i + 1] and n - i - 1 == lst[i + 1]:
				count += 1
				path.append([fr[i], lst[i + 1]])
	print(count)
	for e in path:
		print(e[0], e[1])


for case in range(int(input())):
	N = int(input())
	L = list(map(int, input().split()))
	back = [False for i in range(N)]
	mis = set()
	ma = 0
	for i in range(N - 1, 0, -1):
		num = L[i]
		if num > ma:
			for j in range(ma + 1, num):
				mis.add(j)
			ma = num
		else:
			if num not in mis:
				break
			mis.remove(num)
		if len(mis) == 0:
			back[i] = True
	out = []
	mis = set()
	ma = 0
	for i in range(N - 1):
		num = L[i]
		if num > ma:
			for j in range(ma + 1, num):
				mis.add(j)
			ma = num
		else:
			if num not in mis:
				break
			mis.remove(num)
		if len(mis) == 0 and back[i + 1]:
			out.append((i + 1, N - i - 1))
	print(len(out))
	for (l1, l2) in out:
		print(l1, l2)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	c = Counter(x)
	u1 = set((v for v in c if c[v] == 1))
	u2 = set((v for v in c if c[v] == 2))
	l1 = len(u1)
	l2 = len(u2)
	if not l2 or l1 + 2 * l2 != n:
		print(0)
	elif u2 != set(range(1, l2 + 1)):
		print(0)
	elif u1 != set(range(l2 + 1, n - l2 + 1)):
		print(0)
	else:
		r = []
		if set(x[:l2]) == u2:
			r.append((l2, n - l2))
		if l1 and set(x[-l2:]) == u2:
			r.append((n - l2, l2))
		print(len(r))
		for v in r:
			print(*v)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	p1 = [0] * n
	p2 = [0] * n
	s = 0
	ctr = 0
	max = 1
	sett = set()
	c = 0
	for i in a:
		s += i
		ctr += 1
		if i in sett:
			break
		if ctr * (ctr + 1) // 2 == s:
			p1[c] = 1
		else:
			p1[c] = 0
		sett.add(i)
		c += 1
	a.reverse()
	c = 0
	s = 0
	ctr = 0
	sett1 = set()
	for i in a:
		s += i
		ctr += 1
		if i in sett1:
			break
		if ctr * (ctr + 1) // 2 == s:
			p2[c] = 1
		else:
			p2[c] = 0
		sett1.add(i)
		c += 1
	p2.reverse()
	p3 = []
	ans = []
	for i in range(n):
		if p1[i] == 1 and p2[i + 1] == 1:
			ans.append([i + 1, n - i - 1])
	print(len(ans))
	for i in ans:
		print(i[0], i[1])


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] + a[:]
	left = [0] * (n + 1)
	right = [0] * (n + 1)
	ma = 1
	d = {}
	for i in range(1, n + 1):
		if b[i] in d:
			break
		d[b[i]] = 1
		ma = max(ma, b[i])
		if ma == i:
			left[i] = 1
	b = [0] + a[::-1]
	ma = 1
	d = {}
	for i in range(1, n + 1):
		if b[i] in d:
			break
		d[b[i]] = 1
		ma = max(ma, b[i])
		if ma == i:
			right[i] = 1
	ans = 0
	ind = []
	for i in range(1, n + 1):
		if left[i] * right[n - i]:
			ans += 1
			ind.append(i)
	print(ans)
	for i in ind:
		print(i, n - i)


from collections import defaultdict
tc = int(input())
for zzz in range(tc):
	svn = defaultdict(int)
	zah = defaultdict(int)
	n = int(input())
	arr = list(map(int, input().split()))
	left = [0] * n
	right = [0] * n
	deci = True
	sum1 = 0
	sum2 = 0
	for i in range(n):
		sum1 += i + 1
		sum2 += arr[i]
		if svn[arr[i]] != 0:
			deci = False
		svn[arr[i]] += 1
		if sum1 == sum2 and deci:
			left[i] = 1
	sum1 = 0
	sum2 = 0
	deci = True
	for i in range(n - 1, -1, -1):
		sum1 += n - 1 - i + 1
		sum2 += arr[i]
		if zah[arr[i]] != 0:
			deci = False
		zah[arr[i]] += 1
		if sum1 == sum2 and deci:
			right[i] = 1
	coun = 0
	ans = []
	for i in range(0, n - 1):
		if left[i] == 1 and right[i + 1] == 1:
			coun += 1
			ans.append((i + 1, n - (i + 1)))
	print(coun)
	for ele in ans:
		print(ele[0], ele[1])


import sys
from sys import stdin, stdout

def R():
	return map(int, stdin.readline().strip().split())
ans = []
for h in range(int(input())):
	n = int(input())
	arr = list(R())
	dp1 = [0 for i in range(n)]
	dp2 = [0 for i in range(n)]
	seti = set()
	maxi = 0
	for i in range(n):
		if arr[i] in seti:
			break
		seti.add(arr[i])
		maxi = max(arr[i], maxi)
		if maxi == i + 1:
			dp1[i] = 1
	seti = set()
	maxi = 0
	for i in range(n - 1, -1, -1):
		if arr[i] in seti:
			break
		seti.add(arr[i])
		maxi = max(arr[i], maxi)
		if maxi == n - i:
			dp2[i] = 1
	t = []
	tot = 0
	for i in range(n - 1):
		if dp1[i] == dp2[i + 1] == 1:
			tot += 1
			t.append((i + 1, n - i - 1))
	print(tot)
	if tot:
		for i in t:
			print(*i)


from math import *
mod = 1000000007
for zz in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	ans = []
	cs = set()
	d = {}
	c = 0
	for i in range(n):
		if a[i] not in d:
			c += 1
			d[a[i]] = 0
		d[a[i]] += 1
	mv = 0
	m = [0] * n
	m[-1] = a[-1]
	for i in range(n - 2, -1, -1):
		m[i] = max(m[i + 1], a[i])
	for i in range(n):
		mv = max(a[i], mv)
		if a[i] in cs:
			break
		cs.add(a[i])
		d[a[i]] -= 1
		if d[a[i]] <= 0:
			c -= 1
		if mv == i + 1 and c == n - i - 1 and (m[i + 1] == n - i - 1):
			ans.append(i)
	print(len(ans))
	for i in ans:
		print(i + 1, n - i - 1)


import sys
input = lambda : sys.stdin.readline().strip()
ipnut = input
for i in range(int(input())):
	n = int(ipnut())
	a = list(map(int, ipnut().split()))
	ans = []
	s = {}
	ma = a[0]
	f = False
	u = [0] * n
	for j in a:
		u[j - 1] += 1
	must = 2
	an = 0
	f = False
	flag = True
	k = -1
	for i in u:
		k += 1
		if must < i:
			f = True
			break
		elif flag and i <= 1:
			an = k
			flag = False
		must = i
	if f or an == n or an == 0:
		print(0)
		continue
	f1 = True
	f2 = True
	t = [0] * n
	t1 = [0] * n
	for i in range(an):
		if a[i] > an or t[a[i] - 1]:
			f1 = False
		if a[-1 - i] > an or t1[a[-1 - i] - 1]:
			f2 = False
		t[a[i] - 1] += 1
		t1[a[-1 - i] - 1] += 1
	print(max(0, f1 + f2 - int(an == n - an)))
	if f1:
		print(an, n - an)
	if f2 and an != n - an:
		print(n - an, an)


t = int(input())
for test in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	min1 = [0 for i in range(n)]
	min2 = [0 for i in range(n)]
	max1 = [0 for i in range(n)]
	max2 = [0 for i in range(n)]
	visited = [False for i in range(n + 5)]
	asc = [False for i in range(n)]
	asc[0] = True
	visited[arr[0]] = True
	for i in range(1, n):
		if visited[arr[i]]:
			asc[i] = False
		else:
			visited[arr[i]] = True
			asc[i] = asc[i - 1]
	visited = [False for i in range(n + 5)]
	desc = [False for i in range(n)]
	desc[n - 1] = True
	visited[arr[n - 1]] = True
	for i in range(n - 2, -1, -1):
		if visited[arr[i]]:
			desc[i] = False
		else:
			visited[arr[i]] = True
			desc[i] = desc[i + 1]
	min1[0] = arr[0]
	max1[0] = arr[0]
	for i in range(1, n):
		min1[i] = min(min1[i - 1], arr[i])
		max1[i] = max(max1[i - 1], arr[i])
	min2[n - 1] = arr[n - 1]
	max2[n - 1] = arr[n - 1]
	for i in range(n - 2, -1, -1):
		min2[i] = min(min2[i + 1], arr[i])
		max2[i] = max(max2[i + 1], arr[i])
	res = []
	for i in range(n - 1):
		flag1 = False
		if min1[i] == 1 and max1[i] == i + 1:
			flag1 = True
		flag2 = False
		if min2[i + 1] == 1 and max2[i + 1] == n - 1 - i:
			flag2 = True
		if flag1 and flag2 and asc[i] and desc[i + 1]:
			res.append([i + 1, n - 1 - i])
	print(len(res))
	for i in range(len(res)):
		print(res[i][0], res[i][1])


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	count = 1
	s1 = set([arr[0]])
	max1 = arr[0]
	d1 = {}
	if max1 == 1:
		d1[1] = 1
	for i in range(1, n):
		max1 = max(max1, arr[i])
		s1.add(arr[i])
		count += 1
		if len(s1) == max1 and count == max1:
			d1[count] = 1
	d2 = {}
	s2 = set([arr[n - 1]])
	max2 = arr[n - 1]
	count = 1
	if max2 == 1:
		d2[1] = 1
	for i in range(n - 2, -1, -1):
		max2 = max(max2, arr[i])
		s2.add(arr[i])
		count += 1
		if len(s2) == max2 and count == max2:
			d2[max2] = 1
	dicts = []
	for i in d1:
		if n - i in d2:
			dicts.append([i, n - i])
	print(len(dicts))
	for i in dicts:
		print(*i)


t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	number = sum(a)
	ans1 = []
	ans2 = []
	k = 0
	flag = [False] * n
	num = 0
	ans = 0
	for j in range(0, n):
		if flag[a[j] - 1]:
			break
		flag[a[j] - 1] = True
		num += 1
		while flag[k] and k < n:
			k += 1
		if k == num and num != 0:
			if ans != 0:
				if ans1[ans - 1] != num:
					ans1.append(k)
					ans += 1
			else:
				ans1.append(k)
				ans += 1
	k = 0
	flag = [False] * n
	num = 0
	a.reverse()
	ans = 0
	for j in range(0, n):
		if flag[a[j] - 1]:
			break
		flag[a[j] - 1] = True
		num += 1
		while flag[k] and k < n:
			k += 1
		if k == num and num != 0:
			if ans != 0:
				if ans2[ans - 1] != n - num:
					ans2.append(n - k)
					ans += 1
			else:
				ans2.append(n - k)
				ans += 1
	lg1 = len(ans1)
	lg2 = len(ans2)
	ans2.reverse()
	ansarr = []
	ans = 0
	for j in range(0, lg1):
		l = 0
		r = lg2 - 1
		if lg2 == 0:
			break
		while r - l > 1:
			m = (r + l) // 2
			if ans2[m] > ans1[j]:
				r = m
			else:
				l = m
		if ans2[l] == ans1[j]:
			ansarr.append([ans1[j], n - ans1[j]])
			ans += 1
		elif ans2[r] == ans1[j]:
			ansarr.append([ans1[j], n - ans1[j]])
			ans += 1
	print(ans)
	for j in range(0, ans):
		print(*ansarr[j])


from sys import stdin
input = stdin.buffer.readline

def f(i, pref):
	if pref[i] == (i + 1) * (i + 2) // 2 and pref[-1] - pref[i] == (n - i - 1) * (n - i) // 2:
		return True
	return False
for _ in range(int(input())):
	n = int(input())
	(*a,) = map(int, input().split())
	d = {}
	flag = 0
	(l, r) = (0, n - 1)
	for i in range(n):
		if a[i] not in d:
			d[a[i]] = [i]
		else:
			if len(d[a[i]]) == 2:
				flag = 1
				break
			d[a[i]].append(i)
			l = max(l, d[a[i]][0])
			r = min(r, d[a[i]][1])
	if flag or r < l:
		print(0)
		continue
	pref = [a[0]]
	for i in range(1, n):
		pref.append(pref[-1] + a[i])
	ans = []
	for i in range(l, r):
		if f(i, pref):
			ans.append([i + 1, n - i - 1])
	print(len(ans))
	for i in ans:
		print(*i)


t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(map(int, input().split()))
	len_p1 = len(set(a))
	len_p2 = n - len_p1
	if len_p1 + len_p2 != n or len_p1 == n or len_p2 == n:
		print(0)
	else:
		length = []
		ans = 0
		f1 = 0
		if len_p2 == len_p1:
			j = 1
		else:
			j = 2
		for p in range(0, j):
			if p == 0:
				k = len_p2 - 1
			else:
				k = len_p1 - 1
			p1 = set(a[:k + 1])
			p2 = set(a[k + 1:])
			if len(p1) == k + 1 and len(p2) == n - (k + 1):
				if max(p1) == k + 1 and max(p2) == n - (k + 1):
					f1 = 1
				else:
					continue
			else:
				continue
			if f1 == 1:
				ans += 1
				length.append(k + 1)
				length.append(n - (k + 1))
		print(ans)
		if ans > 0:
			for k in range(0, ans):
				p = 2 * k
				print(length[p], length[p + 1])


import sys
input = sys.stdin.buffer.readline
from collections import Counter as C
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	cnts = C(a)
	for i in range(1, n + 3):
		if cnts[i] < 2:
			p1Len = i - 1
			break
	p2Len = n - p1Len
	ans = []
	if p1Len > 0 and p2Len > 0:
		if set(a[:p1Len]) == set(range(1, p1Len + 1)) and set(a[p1Len:]) == set(range(1, p2Len + 1)):
			ans.append([p1Len, p2Len])
		if p1Len != p2Len:
			if set(a[:p2Len]) == set(range(1, p2Len + 1)) and set(a[p2Len:]) == set(range(1, p1Len + 1)):
				ans.append([p2Len, p1Len])
	print(len(ans))
	for (l1, l2) in ans:
		print('{} {}'.format(l1, l2))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(max1, min1, max2, min2) = ([], [], [], [])
	(dict_1, dict_2) = ([], [])
	for i in range(n):
		max1.append(0)
		max2.append(0)
		min1.append(0)
		min2.append(0)
		dict_1.append(0)
		dict_2.append(0)
	max1[0] = a[0]
	min1[0] = a[0]
	max2[n - 1] = a[n - 1]
	min2[n - 1] = a[n - 1]
	dict = {}
	dict[a[0]] = 1
	dict_1[0] = 1
	for i in range(1, n):
		if dict.get(a[i]) is None:
			dict[a[i]] = 1
		max1[i] = max(max1[i - 1], a[i])
		min1[i] = min(min1[i - 1], a[i])
		dict_1[i] = len(dict)
	dict = {}
	dict[a[n - 1]] = 1
	dict_2[n - 1] = 1
	for i in range(n - 2, -1, -1):
		if dict.get(a[i]) is None:
			dict[a[i]] = 1
		max2[i] = max(max2[i + 1], a[i])
		min2[i] = min(min2[i + 1], a[i])
		dict_2[i] = len(dict)
	count = 0
	ans = []
	for i in range(n - 1):
		a = i + 1
		b = n - a
		if dict_1[i] == a and dict_2[i + 1] == b and (min1[i] == 1) and (max1[i] == a) and (max2[i + 1] == b) and (min2[i + 1] == 1):
			count += 1
			ans.append((a, b))
	print(count)
	for i in range(len(ans)):
		print(ans[i][0], ans[i][1])


def judge_list(num_list, max_num):
	l = len(num_list)
	temp = [0] * (max_num + 1)
	temp_max = max(num_list)
	if temp_max != l:
		return False
	for i in range(0, l):
		if temp[num_list[i]] == 0:
			temp[num_list[i]] = 1
		else:
			return False
	return True
n = int(input())
for i in range(n):
	ori_len = int(input())
	ori_list = [int(q) for q in input().split()]
	max_num = max(ori_list)
	max_tags = [m for (m, n) in enumerate(ori_list) if n == max_num]
	res_num = 0
	res_mark_list = []
	if len(max_tags) == 1 and max_num < ori_len:
		if max_tags[0] + 1 <= max_num:
			if judge_list(ori_list[0:max_num], max_num) and judge_list(ori_list[max_num:ori_len], max_num):
				res_num += 1
				res_mark_list.append(max_num)
		if ori_len - max_tags[0] - 1 <= max_num:
			if judge_list(ori_list[0:ori_len - max_num], max_num) and judge_list(ori_list[ori_len - max_num:ori_len], max_num):
				res_num += 1
				res_mark_list.append(ori_len - max_num)
	elif len(max_tags) == 2 and max_num * 2 == ori_len:
		if judge_list(ori_list[0:max_num], max_num) and judge_list(ori_list[max_num:ori_len], max_num):
			res_num += 1
			res_mark_list.append(max_num)
	print(res_num)
	for m in res_mark_list[::-1]:
		print(str(m) + ' ' + str(ori_len - m))


def solution():
	for _ in range(int(input())):
		n = int(input())
		arr = [int(i) for i in input().split()]
		temp = sorted(arr)
		current = 0
		while current < n - 1:
			if temp[current] == temp[current + 1]:
				current += 2
			else:
				length = current // 2
				break
		else:
			length = n // 2
		origin = {i for i in range(1, length + 1)}
		mid = set(temp[current:])
		if len(mid) != n - length * 2 or mid != {i for i in range(length + 1, n - length + 1)}:
			print(0)
			continue
		left = set(arr[:length])
		right = set(arr[n - length:])
		counter = 0
		if left == origin and length != n - length:
			counter += 1
		if right == origin:
			counter += 1
		print(counter)
		if counter == 0:
			continue
		if left == origin and length != n - length:
			print(length, n - length)
		if origin == right:
			print(n - length, length)
solution()


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		n = int(input())
		aa = [int(a) for a in input().split()]
		counts = [0] * (n + 1)
		mx = 0
		for a in aa:
			counts[a] += 1
			mx = max(a, mx)
		if mx == n:
			print(0)
			return
		twocounts = 0
		mxtwo = 0
		for (i, c) in enumerate(counts[1:mx + 1], 1):
			if c > 2 or c == 0:
				print(0)
				return
			if c == 2:
				twocounts += 1
				mxtwo = max(mxtwo, i)
		if mxtwo != twocounts:
			print(0)
			return
		found = [0] * (mxtwo + 1)
		for a in aa[:mxtwo]:
			if a > mxtwo:
				break
			found[a] += 1
		start = all(map(lambda f: f == 1, found[1:]))
		found = [0] * (mxtwo + 1)
		for a in aa[-1:-mxtwo - 1:-1]:
			if a > mxtwo:
				break
			found[a] += 1
		end = all(map(lambda f: f == 1, found[1:]))
		if mxtwo == n - mxtwo:
			end = False
		if start and end:
			print(2)
		elif start or end:
			print(1)
		else:
			print(0)
		if start:
			print(mxtwo, n - mxtwo)
		if end:
			print(n - mxtwo, mxtwo)
	q = int(input())
	for _ in range(q):
		solve()
main()


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from collections import defaultdict as dd, deque

def data():
	return sys.stdin.readline().strip()

def mdata():
	return map(int, data().split())
mod = int(1000000000.0 + 7)
for t in range(int(data())):
	(n,) = mdata()
	A = list(mdata())
	dp1 = [0] * n
	dp2 = [0] * n
	m1 = 0
	m2 = 0
	s1 = set()
	s2 = set()
	for i in range(n):
		s1.add(A[i])
		m1 = max(m1, A[i])
		dp1[i] = [m1, len(s1)]
		s2.add(A[n - i - 1])
		m2 = max(m2, A[n - 1 - i])
		dp2[n - 1 - i] = [m2, len(s2)]
	cnt = 0
	l = []
	for i in range(n - 1):
		if dp1[i][1] == dp1[i][0] == i + 1 and dp2[i + 1][1] == dp2[i + 1][0] == n - i - 1:
			cnt += 1
			l.append([i + 1, n - i - 1])
	print(cnt)
	for i in range(cnt):
		print(l[i][0], l[i][1])


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = [int(x) for x in inp().split()]
	maxi = max(a)
	answers = 0
	ans = []
	p1 = n - maxi
	p2 = maxi
	needed1 = list(range(1, p1 + 1))
	needed2 = list(range(1, p2 + 1))
	found1 = []
	found2 = []
	flag = True
	for i in range(n):
		if i <= p1 - 1:
			found1.append(a[i])
		else:
			found2.append(a[i])
		if i == p1 - 1:
			if list(sorted(found1)) == list(sorted(needed1)):
				continue
			else:
				flag = False
				break
		elif i == n - 1:
			if list(sorted(found2)) == list(sorted(needed2)):
				continue
			else:
				flag = False
				break
	if flag:
		answers += 1
		ans.append([p1, p2])
	p1 = maxi
	p2 = n - maxi
	needed1 = list(range(1, p1 + 1))
	needed2 = list(range(1, p2 + 1))
	found1 = []
	found2 = []
	flag = True
	for i in range(n):
		if i <= p1 - 1:
			found1.append(a[i])
		else:
			found2.append(a[i])
		if i == p1 - 1:
			if list(sorted(found1)) == list(sorted(needed1)):
				continue
			else:
				flag = False
				break
		elif i == n - 1:
			if list(sorted(found2)) == list(sorted(needed2)):
				continue
			else:
				flag = False
				break
	if flag:
		answers += 1
		ans.append([p1, p2])
	if len(ans) > 1 and ans[0] == ans[1]:
		ans.pop()
		answers -= 1
	print(answers)
	for i in ans:
		print(*i)


from sys import stdin

def func(n):
	a = n * (n + 1)
	b = n + n + 1
	return a * b // 6
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	ans = []
	pre = []
	suff = []
	P = []
	S = []
	m = 0
	M = 0
	for i in range(n):
		m += arr[i]
		M += pow(arr[i], 2)
		pre.append(m)
		P.append(M)
	m = 0
	M = 0
	for i in range(n - 1, -1, -1):
		m += arr[i]
		M += pow(arr[i], 2)
		suff.append(m)
		S.append(M)
	for i in range(1, n):
		if pre[i - 1] == i * (i + 1) // 2 and P[i - 1] == func(i):
			if suff[n - i - 1] == (n - i) * (n - i + 1) // 2 and S[n - i - 1] == func(n - i):
				ans.append([i, n - i])
	print(len(ans))
	for ele in ans:
		print(ele[0], ele[1])


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	m1 = [0] * n
	m2 = [0] * n
	x = set()
	ans = []
	mx = 0
	one = False
	for i in range(n):
		if l[i] in x:
			break
		else:
			if l[i] == 1:
				one = True
			mx = max(mx, l[i])
			x.add(l[i])
			if one and mx == len(x):
				m1[i] = len(x)
	x = set()
	mx = 0
	one = False
	for i in range(n - 1, -1, -1):
		if l[i] in x:
			break
		else:
			if l[i] == 1:
				one = True
			mx = max(mx, l[i])
			x.add(l[i])
			if one and mx == len(x):
				m2[i] = len(x)
	for i in range(n):
		if m1[i] != 0 and i + 1 < n:
			if m2[i + 1] != 0:
				ans.append((m1[i], m2[i + 1]))
	print(len(ans))
	for i in range(len(ans)):
		print(ans[i][0], ans[i][1])


from sys import exit
from collections import Counter

def i():
	return input()

def ii():
	return int(input())

def iis():
	return map(int, input().split())

def liis():
	return list(map(int, input().split()))

def print_array(a):
	print(' '.join(map(str, a)))
t = ii()
for _ in range(t):
	n = ii()
	a = liis()
	jose = Counter(a)
	cur = 0
	for i in range(1, n):
		if i not in jose:
			break
		if jose[i] == 2:
			cur += 1
		else:
			break
	maxi = cur
	for i in range(cur + 1, n):
		if i in jose:
			maxi += 1
		else:
			break
	first = [i for i in range(1, cur + 1)]
	final = [i for i in range(1, maxi + 1)]
	first_set = set(first)
	final_first_set = set(final)
	second_set = set(first)
	final_second_set = set(final)
	possible = 0
	ans = []
	can = True
	for i in range(len(first)):
		if a[i] in first_set:
			first_set.remove(a[i])
		else:
			can = False
			break
	for i in range(len(final)):
		if a[len(a) - i - 1] in final_first_set:
			final_first_set.remove(a[len(a) - i - 1])
		else:
			can = False
			break
	if can and (not len(first_set)) and (not len(final_first_set)):
		possible += 1
		ans.append([len(first), n - len(first)])
	can = True
	for i in range(len(first)):
		if a[len(a) - i - 1] in second_set:
			second_set.remove(a[len(a) - i - 1])
		else:
			can = False
			break
	for i in range(len(final)):
		if a[i] in final_second_set:
			final_second_set.remove(a[i])
		else:
			can = False
			break
	if can and (not len(final_second_set)) and (not len(second_set)):
		possible += 1
		ans.append([n - len(first), len(first)])
	if len(ans) == 2 and ans[0] == ans[1]:
		ans.pop()
	if possible and len(final) + len(first) == n:
		print(len(ans))
		for i in ans:
			print(i[0], i[1])
	else:
		print(0)


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	n = int(input())
	a = [0] + list(mapi())
	mx = 0
	mp = {}
	dp = [[0] * 2 for i in range(n + 5)]
	for i in range(1, n + 1):
		if a[i] not in mp:
			mp[a[i]] = 1
			mx = max(mx, a[i])
			if mx == i:
				dp[i][0] = 1
		else:
			break
	mp = {}
	mx = 0
	for i in range(n, 0, -1):
		if a[i] not in mp:
			mp[a[i]] = 1
			mx = max(a[i], mx)
			if mx == n - i + 1:
				dp[i][1] = 1
		else:
			break
	mp = {}
	res = 0
	for i in range(2, n + 1):
		if dp[i - 1][0] and dp[i][1]:
			res += 1
	print(res)
	for i in range(2, n + 1):
		if dp[i - 1][0] and dp[i][1]:
			print(i - 1, n - i + 1)
		dp[i][1] = 0


def check(arr):
	larr = len(arr)
	r = [0] * (larr + 1)
	for i in arr:
		if i > larr:
			return False
		r[i] += 1
	return all([i == 1 for i in r[1:]])
N = int(input())
for _ in range(N):
	K = int(input())
	A = list(map(int, input().split()))
	doubled = [0] * K
	for i in A:
		doubled[i] += 1
	md = max([num for (num, i) in enumerate(doubled) if i == 2] + [0])
	if md == 0:
		print(0)
	elif K == md * 2:
		if check(A[:md]) and check(A[md:]):
			print(1)
			print(md, md)
		else:
			print(0)
	else:
		res = []
		if check(A[:md]) and check(A[md:]):
			res.append((md, K - md))
		if check(A[K - md:]) and check(A[:K - md]):
			res.append((K - md, md))
		print(len(res))
		for (i, j) in res:
			print('%d %d' % (i, j))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	pre = [False] * n
	pos = [False] * n
	count = [0] * (n + 1)
	d = 0
	su = 0
	for i in range(len(a)):
		if count[a[i]] == 0:
			count[a[i]] += 1
			su = su + a[i]
			d += 1
		else:
			break
		if d == i + 1 and d * (d + 1) // 2 == su:
			pre[i] = True
	a.reverse()
	count = [0] * (n + 1)
	d = 0
	su = 0
	for i in range(len(a)):
		if count[a[i]] == 0:
			count[a[i]] += 1
			su = su + a[i]
			d += 1
		else:
			break
		if d == i + 1 and d * (d + 1) // 2 == su:
			pos[i] = True
	pos.reverse()
	ans = []
	count = 0
	for i in range(n - 1):
		if pre[i] and pos[i + 1]:
			count += 1
			ans.append((i + 1, n - (i + 1)))
	print(count)
	for i in ans:
		print(i[0], i[1])


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().strip().split()]
	aset = set([])
	res = []
	s = 0
	ts = sum(a)
	dic = {}
	for e in a:
		if e not in dic:
			dic[e] = 0
		dic[e] += 1
	flag = True
	bad = set([])
	for d in dic:
		if dic[d] > 2:
			flag = False
			break
		elif dic[d] == 2:
			bad.add(d)
	if flag:
		for i in range(n - 1):
			if a[i] not in aset:
				s += a[i]
				aset.add(a[i])
				if a[i] in bad:
					bad.remove(a[i])
				if (i + 1) * (i + 2) // 2 == s:
					ps = ts - s
					rem = n - (i + 1)
					if ps == rem * (rem + 1) // 2 and len(bad) == 0:
						res.append(i + 1)
			else:
				break
		print(len(res))
		for r in res:
			print(r, n - r)
	else:
		print(0)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	d1 = {}
	d2 = {}
	stop = -1
	for (num, i) in enumerate(arr[::-1]):
		if i not in d2:
			d2[i] = 0
		d2[i] += 1
		if stop == -1 and d2[i] > 1:
			stop = num
	if stop != -1:
		stop = n - stop - 1
	(left, right) = ([(10 ** 9, 0)], [(10 ** 9, 0)])
	for i in arr:
		left.append((min(left[-1][0], i), max(left[-1][1], i)))
	left = left[1:]
	for i in arr[::-1]:
		right.append((min(right[-1][0], i), max(right[-1][1], i)))
	right = right[1:]
	right = right[::-1]
	ans = []
	for (num, i) in enumerate(arr[:-1]):
		if i in d1:
			break
		d1[i] = 1
		d2[i] -= 1
		if d2[i] == 0:
			d2.pop(i)
		if left[num] == (1, len(d1)) and right[num + 1] == (1, len(d2)) and (stop == -1 or num >= stop):
			ans.append((len(d1), len(d2)))
	print(len(ans))
	for line in ans:
		print(*line)


import sys, bisect
from math import gcd
input = sys.stdin.readline
from collections import defaultdict

def inp():
	return int(input().rstrip())

def inlt():
	return list(map(int, input().rstrip().split()))

def insr():
	s = input().rstrip()
	return s[:len(s) - 1]

def invr():
	return map(int, input().rstrip().split())

def cal(n):
	return n * (n + 1) // 2
t = inp()
for _ in range(t):
	n = inp()
	nums = inlt()
	pre = [0 for i in range(n)]
	pre[0] = nums[0]
	for i in range(1, n):
		pre[i] = pre[i - 1] + nums[i]
	fs = 0
	ss = 0
	ans = []
	d = defaultdict(int)
	for i in nums:
		d[i] += 1
	big = max(nums)
	has = True
	for i in range(1, big + 1):
		if i not in d:
			has = False
			break
		if d[i] >= 3:
			has = False
			break
	if has:
		vl = set()
		for i in range(n):
			if nums[i] in vl:
				break
			vl.add(nums[i])
			d[nums[i]] -= 1
			if d[nums[i]] <= 0:
				del d[nums[i]]
			if len(d) != n - i - 1:
				continue
			first_s = pre[i]
			se_s = pre[n - 1] - pre[i]
			if cal(i + 1) == first_s and cal(n - i - 1) == se_s:
				if i + 1 < n:
					ans.append(i + 1)
	print(len(ans))
	for i in ans:
		print(i, n - i)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = 0
	c = 0
	s = set()
	ans = [True] * n
	for i in range(n):
		m = max(m, a[i])
		if a[i] not in s:
			s.add(a[i])
			c += 1
		if not (c == i + 1 and m == i + 1):
			ans[i] = False
	m = 0
	c = 0
	s = set()
	for i in range(n - 1, 0, -1):
		m = max(m, a[i])
		if a[i] not in s:
			s.add(a[i])
			c += 1
		if not (c == n - i and m == n - i):
			ans[i - 1] = False
	print(ans.count(True))
	for i in range(n - 1):
		if ans[i]:
			print(i + 1, n - i - 1)


t = int(input())
for i in range(t):
	a = int(input())
	array = [int(s) for s in input().split()]
	check = {}
	exists = True
	max_with_2 = -1
	for i in range(len(array)):
		if array[i] not in check:
			check[array[i]] = 1
		else:
			check[array[i]] += 1
	for (key, value) in check.items():
		if value > 2:
			exists = False
		elif value == 2 and key > max_with_2:
			max_with_2 = key
	for i in range(1, max_with_2):
		if i not in check:
			exists = False
		elif check[i] != 2 and i <= max_with_2:
			exists = False
	if not exists:
		print(0)
		continue
	counter = 0
	max_ls = []
	max_l = -1
	max_r = -1
	max_rs = []
	sums_l = [0]
	sums_r = [0]
	for i in range(len(array)):
		if array[i] > max_l:
			max_l = array[i]
		max_ls.append(max_l)
		sums_l.append(sums_l[-1] + array[i])
		if array[len(array) - 1 - i] > max_r:
			max_r = array[len(array) - 1 - i]
		sums_r.append(sums_r[-1] + array[len(array) - 1 - i])
		max_rs.append(max_r)
	sums_l = sums_l[1:]
	sums_r = sums_r[1:]
	ans = []
	for i in range(len(array)):
		if i + 1 == max_ls[i] and len(array) - i - 1 == max_rs[len(array) - i - 2]:
			if sums_l[i] == max_ls[i] * (max_ls[i] + 1) // 2 and sums_r[len(array) - i - 2] == max_rs[len(array) - i - 2] * (max_rs[len(array) - i - 2] + 1) // 2:
				ans.append([i + 1, len(array) - i - 1])
	print(len(ans))
	for i in range(len(ans)):
		print(ans[i][0], ans[i][1])


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	cml = [0] + A
	for i in range(1, n + 1):
		cml[i] = max(cml[i - 1], cml[i])
	cmr = A + [0]
	cmr.reverse()
	for i in range(1, n + 1):
		cmr[i] = max(cmr[i - 1], cmr[i])
	l = []
	import copy
	r = copy.copy(A)
	r.reverse()
	k = 0
	ans = []
	ng = set()
	l_ = set()
	l_temp = []
	for i in range(n - 1):
		l_temp.append(A[i])
		l_.add(A[i])
		if len(l_temp) != len(l_):
			ng.add(i)
	r_temp = []
	r_ = set()
	for j in range(n - 1):
		r_temp.append(A[n - j - 1])
		r_.add(A[n - j - 1])
		if len(r_temp) != len(r_):
			ng.add(n - j - 2)
	for i in range(n - 1):
		l.append(A[i])
		r.pop()
		if i in ng:
			continue
		if cml[i + 1] == i + 1 and cmr[n - i - 1] == n - i - 1:
			k += 1
			ans.append([i + 1, n - i - 1])
	print(k)
	if k != 0:
		for i in range(len(ans)):
			print(*ans[i])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		c = collections.Counter(a)
		m = max(a)
		m2 = n - m
		ok = m2 > 0
		for i in range(1, m2 + 1):
			if c[i] != 2:
				ok = 0
				break
		for i in range(m2 + 1, m + 1):
			if c[i] != 1:
				ok = 0
				break
		if ok:
			r = []
			if max(a[:m2]) == m2 and len(set(a[:m2])) == m2:
				r.append([m2, m])
			if m != m2 and max(a[-m2:]) == m2 and (len(set(a[-m2:])) == m2):
				r.append([m, m2])
			rr.append(len(r))
			if r:
				rr.append(JAA(r, '\n', ' '))
		else:
			rr.append(0)
	return JA(rr, '\n')
print(main())


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d1 = {}
	d2 = {}
	for elem in a:
		d1[elem] = 1 + d1.get(elem, 0)
	b = []
	s = sum(a)
	c = 0
	for i in range(n):
		c += a[i]
		d2[a[i]] = 1 + d2.get(a[i], 0)
		d1[a[i]] -= 1
		if d1[a[i]] == 0:
			d1.pop(a[i], None)
		if (i + 1) * (i + 2) // 2 == c and s - c == (n - 1 - i) * (n - i) // 2 and (len(d2) == i + 1) and (len(d1) == n - i - 1):
			b.append((i + 1, n - i - 1))
	print(len(b))
	for elem in b:
		print(*elem)


import sys
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
ni = lambda : int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda : list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda : float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda : list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda : stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda : stdin.readline().split()
from collections import defaultdict

def check(a):
	a.sort()
	j = 1
	for i in a:
		if i != j:
			return False
		j += 1
	return True

def sol():
	n = ni()
	a = na()
	maxA = max(a)
	ans = []
	if check(a[:n - maxA]) and check(a[n - maxA:]):
		ans.append((n - maxA, maxA))
	if maxA * 2 != n and check(a[:maxA]) and check(a[maxA:]):
		ans.append((maxA, n - maxA))
	print(len(ans))
	for (l, r) in ans:
		print(l, r)
t = ni()
for i in range(t):
	sol()


for _ in range(int(input())):
	n = int(input())
	a = [int(o) for o in input().split()]
	maxm = max(a)
	count = [0 for i in range(n + 1)]
	count1 = [0 for i in range(maxm + 1)]
	count2 = [0 for i in range(maxm + 1)]
	for i in a:
		count[i] += 1
	i = 1
	while count[i] > 1:
		i += 1
	lower = i - 1
	flag1 = 0
	flag2 = 0
	for i in range(maxm):
		count1[a[i]] += 1
	for i in range(1, maxm + 1):
		if count1[i] != 1:
			flag1 = 1
	for i in range(n - 1, n - 1 - maxm, -1):
		count2[a[i]] += 1
	for i in range(1, maxm + 1):
		if count2[i] != 1:
			flag2 = 1
	if lower + maxm is not n:
		print(0)
	elif maxm == n:
		print(0)
	elif flag1 is 1 and flag2 is 1:
		print(0)
	elif flag1 is 0 and flag2 is 0:
		if maxm == n - maxm:
			print(1)
			print(maxm, n - maxm)
		else:
			print(2)
			print(n - maxm, maxm)
			print(maxm, n - maxm)
	elif flag1 is 0:
		print(1)
		print(maxm, n - maxm)
	elif flag2 is 0:
		print(1)
		print(n - maxm, maxm)


from collections import defaultdict

def traverse(a):
	d = defaultdict(lambda : 0)
	res_left = [False] * len(a)
	mx_left = 0
	for (i, val) in enumerate(a):
		d[val] += 1
		if d[val] > 1:
			break
		mx_left = max(mx_left, val)
		if mx_left == i + 1:
			res_left[i] = True
	return res_left

def solve(a):
	(validity_left, validity_right) = (traverse(a), traverse(a[::-1]))
	validity_right = validity_right[::-1]
	res = list()
	for i in range(len(validity_left) - 1):
		if validity_left[i] and validity_right[i + 1]:
			res.append((i + 1, n - i - 1))
	return res
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(right_res, left_res) = ([], [])
	res = solve(a)
	print(len(res))
	for r in res:
		print(r[0], r[1])


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	a = [int(ai) for ai in input().split()]
	s = sum(a)
	summer = 0
	res = []
	setter = set()
	rsetter = Counter(a)
	rsetter_cnt = n
	for (i, ai) in enumerate(a):
		summer += ai
		setter.add(ai)
		rsetter[ai] -= 1
		if rsetter[ai] == 0:
			del rsetter[ai]
		rsetter_cnt -= 1
		if summer == (i + 1) * (i + 2) // 2 and len(setter) == i + 1:
			rem = s - summer
			j = n - i - 1
			if rem == j * (j + 1) // 2 and rsetter_cnt == len(rsetter):
				res.append((i + 1, j))
	print(len(res))
	for (i, j) in res:
		print(i, j)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	mySet = set()
	rank = 1
	dpL1 = [0 for i in range(n)]
	for i in range(n):
		if l[i] in mySet:
			break
		mySet.add(l[i])
		while rank in mySet:
			mySet.remove(rank)
			rank += 1
		if len(mySet) == 0:
			dpL1[i] = 1
		else:
			dpL1[i] = 0
	l.reverse()
	mySet = set()
	rank = 1
	dpL2 = [0 for i in range(n)]
	for i in range(n):
		if l[i] in mySet:
			break
		mySet.add(l[i])
		while rank in mySet:
			mySet.remove(rank)
			rank += 1
		if len(mySet) == 0:
			dpL2[i] = 1
		else:
			dpL2[i] = 0
	dpL2.reverse()
	res = []
	for i in range(n - 1):
		if dpL1[i] == dpL2[i + 1] == 1:
			res.append((i + 1, n - i - 1))
	if len(res) == 0:
		print(0)
	else:
		print(len(res))
		for (i, j) in res:
			print(i, j)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = max(a)
	b = []
	if m == n - m:
		c = [m]
	else:
		c = [n - m, m]
	for j in c:
		a1 = a[:j]
		a2 = a[j:]
		if len(a1) == len(set(a1)) and max(a1) == len(a1) and (len(a2) == len(set(a2))) and (max(a2) == len(a2)):
			b.append(len(a1))
			b.append(len(a2))
	bb = int(len(b) / 2)
	print(bb)
	if bb > 0:
		for j in range(0, len(b), 2):
			print(b[j], b[j + 1])


import os
import sys
from math import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return map(int, input().split())

def array():
	return [int(i) for i in input().split()]

def calc(n):
	return n * (n - 1) // 2
for _ in range(int(input())):
	n = int(input())
	a = array()
	f = {}
	ans = []
	flag = 1
	for i in a:
		try:
			f[i] += 1
		except:
			f[i] = 1
		if f[i] >= 3:
			flag = 0
			break
	if flag == 0:
		print(0)
		continue
	ma = [a[0]]
	for i in range(1, n):
		ma.append(max(ma[-1], a[i]))
	ma[-1] = (ma[-1], a[-1])
	for i in range(1, n):
		ma[n - 1 - i] = (ma[n - 1 - i], max(ma[n - i][1], a[n - i - 1]))
	for i in range(n - 1):
		if i + 1 == ma[i][0] and n - i - 1 == ma[i + 1][1]:
			if len(set(a[:i + 1])) == i + 1 and len(set(a[i + 1:])) == n - i - 1:
				ans.append((i + 1, n - i - 1))
	print(len(ans))
	for i in ans:
		print(*i)


import sys
from collections import Counter
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def chk(tmp):
	now = 0
	for i in tmp:
		if i - now != 1:
			return False
		now = i
	return True
for _ in range(inp()):
	res = []
	n = inp()
	a = inpl()
	c = Counter(a)
	ok = True
	now = 0
	s = set()
	for key in sorted(list(c)):
		if c[key] >= 3 or key - now > 1:
			ok = False
			break
		if c[key] == 2:
			s.add(key)
		now = key
	if not ok:
		print(0)
		continue
	d = [-1] * n
	ss = set()
	for (i, x) in enumerate(a):
		if x in ss:
			d[i] = 1
		elif x in s:
			d[i] = 0
			ss.add(x)
	cnt = d.count(0)
	ind = 0
	ok = True
	while cnt > 0 and ind < n:
		if d[ind] != 0:
			ok = False
			break
		cnt -= 1
		ind += 1
	if ok:
		ok = True
		tmp1 = sorted(a[:ind])
		tmp2 = sorted(a[ind:])
		if chk(tmp1) and chk(tmp2):
			res += [[ind, n - ind]]
	cnt = d.count(1)
	ind = n - 1
	ok = True
	while cnt > 0 and 0 <= ind:
		if d[ind] != 1:
			ok = False
			break
		cnt -= 1
		ind -= 1
	if ok:
		ok = True
		tmp1 = sorted(a[:ind + 1])
		tmp2 = sorted(a[ind + 1:])
		if chk(tmp1) and chk(tmp2):
			res += [[ind + 1, n - ind - 1]]
	if len(res) == 2 and res[0] == res[1]:
		res = [res[0]]
	print(len(res))
	for i in res:
		print(*i)


def check(n):
	return n * (n + 1) // 2
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	temp = [0] * (n + 1)
	s = 0
	(pre, suf) = ([0] * n, [0] * n)
	for i in range(n):
		if temp[l[i]] == 1:
			break
		temp[l[i]] = 1
		s += l[i]
		if s == check(i + 1):
			pre[i] = 1
	s = 0
	temp = [0] * (n + 1)
	for i in range(n - 1, -1, -1):
		if temp[l[i]]:
			break
		temp[l[i]] = 1
		s += l[i]
		if s == check(n - i):
			suf[i] = 1
	ans = []
	for i in range(1, n):
		if pre[i - 1] == 1 and suf[i] == 1:
			ans.append([i, n - i])
	print(len(ans))
	for i in ans:
		print(i[0], i[1])


T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	cs = 0
	cnt = [0] * n
	cnts = [0] * n
	for i in range(n):
		c += a[i]
		cs += a[i] * a[i] * a[i]
		cnt[i] = c
		cnts[i] = cs
	c = 0
	res = []
	for i in range(n - 1):
		N = i + 1
		k = n - N
		if cnt[i] == N * (N + 1) // 2 and cnt[-1] - cnt[i] == k * (k + 1) // 2 and (cnts[i] == N * (N + 1) // 2 * (N * (N + 1) // 2)) and (cnts[-1] - cnts[i] == k * (k + 1) // 2 * (k * (k + 1) // 2)):
			c += 1
			res.append([N, k])
	print(c)
	for i in res:
		print(*i)


from math import *
from copy import *
from string import *
from random import *
from bisect import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(l):
	n = len(l)
	pre = [0] + list(accumulate(l))
	ans = []
	(d1, d2) = (defaultdict(int), defaultdict(int))
	(left, right) = ([0] * n, [0] * n)
	(s1, s2) = (set(), set())
	(minn, maxx) = (maxsize, -maxsize)
	for i in range(n):
		minn = min(minn, l[i])
		maxx = max(maxx, l[i])
		s1.add(l[i])
		nn = len(s1)
		if minn == 1 and maxx == nn and (i + 1 == nn):
			if i == 0:
				left[i] = 1
			else:
				left[i] = 1
	j = 0
	(minn, maxx) = (maxsize, -maxsize)
	for i in range(n - 1, -1, -1):
		minn = min(minn, l[i])
		maxx = max(maxx, l[i])
		s2.add(l[i])
		nn = len(s2)
		if minn == 1 and maxx == nn and (j + 1 == nn):
			if i == n - 1:
				right[i] = 1
			else:
				right[i] = 1
		j += 1
	ans = []
	for i in range(n - 1):
		if left[i] == right[i + 1] == 1:
			ans.append([i + 1, n - i - 1])
	return ans
	for i in range(1, n + 1):
		pred = i * (i + 1) // 2
		d1[l[i - 1]] += 1
		d2[l[n - i]] += 1
		if len(d1) == i and len(d2) == n - i and (pre[i] == pred) and (pre[-1] - pre[i] == (n - i) * (n - i + 1) // 2) and (n - i != 0):
			ans.append([i, n - i])
	return ans
T = int(input())
for _ in range(T):
	N = int(stdin.readline())
	l = list(map(int, stdin.readline().rstrip().split()))
	ans = solve(l)
	print(len(ans))
	for i in ans:
		print(*i)


from sys import stdin, stdout
from collections import defaultdict
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, stdin.readline().split()))
	d = defaultdict(int)
	(mx, mx1) = (0, 0)
	(mn, mn1) = (20000000, 200000000)
	(ans, ans1) = (True, True)
	c = 0
	l1 = []
	l2 = []
	d1 = defaultdict(int)
	d3 = defaultdict(int)
	d4 = defaultdict(int)
	for j in range(n):
		mx = max(mx, l[j])
		mn = min(mn, l[j])
		d[l[j]] += 1
		if d[l[j]] >= 2:
			ans = False
			break
		if mx == j + 1 and mn == 1 and (ans == True):
			d3[str(j + 1) + ' ' + str(n - j - 1)] = 1
	for j in range(n):
		mx1 = max(mx1, l[n - 1 - j])
		mn1 = min(mn1, l[n - 1 - j])
		d1[l[n - 1 - j]] += 1
		if d1[l[n - 1 - j]] >= 2:
			ans1 = False
			break
		if mx1 == j + 1 and mn1 == 1 and (ans1 == True):
			d4[str(n - j - 1) + ' ' + str(j + 1)] = 1
	for j in d3:
		if d4[j] == 1:
			c += 1
			l1.append(j)
	print(c)
	for j in range(c):
		print(l1[j])


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		ina = int(input())
		lst = list(map(int, input().split()))
		ansp = [lst[0]] + [None] * (ina - 1)
		ansb = [None] * (ina - 1) + [lst[ina - 1]]
		dic1 = {lst[0]: 1}
		dic2 = {}
		for i in range(1, ina):
			front = lst[i]
			back = lst[ina - i - 1]
			currmaxf = ansp[i - 1]
			currmaxb = ansb[ina - i]
			ansp[i] = max(front, currmaxf)
			ansb[ina - i - 1] = max(back, currmaxb)
			freq = dic2.get(lst[i], 0)
			dic2[lst[i]] = freq + 1
		(len1, len2) = (len(dic1), len(dic2))
		ans = []
		if ansp[0] == 1 and ansb[1] == len2 and (ansb[1] == ina - 1):
			ans.append([1, ina - 1])
		for i in range(1, ina - 1):
			front = ansp[i]
			back = ansb[i + 1]
			ele = lst[i]
			freq1 = dic1.get(ele)
			if freq1:
				break
			else:
				len1 += 1
				dic1[ele] = 1
			freq2 = dic2.get(ele)
			dic2[ele] = freq2 - 1
			if freq2 == 1:
				len2 -= 1
			if front == i + 1 and back == ina - i - 1 and (front == len1) and (back == len2):
				ans.append([i + 1, ina - (i + 1)])
		yield len(ans)
		for kap in ans:
			yield (str(kap[0]) + ' ' + str(kap[1]))
t = int(input())
ans = gift()
print(*ans, sep='\n')


import sys
import math as m
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = [0] * n
	for (i, x) in enumerate(a):
		c[x] += 1
	d = 0
	for i in range(1, n):
		if c[i] != 2:
			break
		d += 1
	e = d > 0
	e = e and all((i == j for (i, j) in zip(sorted(a[:d]), range(1, d + 1))))
	e = e and all((i == j for (i, j) in zip(sorted(a[d:]), range(1, n - d + 1))))
	f = d > 0 and 2 * d < n
	f = f and all((i == j for (i, j) in zip(sorted(a[:n - d]), range(1, n - d + 1))))
	f = f and all((i == j for (i, j) in zip(sorted(a[n - d:]), range(1, d + 1))))
	print(e + f)
	if e:
		print(d, n - d)
	if f:
		print(n - d, d)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	min1 = float('inf')
	max1 = 0
	s1 = set()
	is_perm_pref = [False]
	for i in range(n):
		min1 = min(min1, a[i])
		max1 = max(max1, a[i])
		s1.add(a[i])
		if len(s1) == i + 1 and min1 == 1 and (max1 == i + 1):
			is_perm_pref.append(True)
		else:
			is_perm_pref.append(False)
	min2 = float('inf')
	max2 = 0
	s2 = set()
	is_perm_suff = [False]
	for i in range(n - 1, -1, -1):
		min2 = min(min2, a[i])
		max2 = max(max2, a[i])
		s2.add(a[i])
		if len(s2) == n - i and min2 == 1 and (max2 == n - i):
			is_perm_suff.append(True)
		else:
			is_perm_suff.append(False)
	is_perm_suff.reverse()
	ans = []
	for i in range(n + 1):
		if is_perm_pref[i] and is_perm_suff[i]:
			ans.append((i, n - i))
	print(len(ans))
	for i in ans:
		print(*i)