Problem: You are given an array of length . A positive integer is called good if it is impossible to find a subsegment of the array such that the least common multiple of all its elements is equal to .
You need to find the smallest good integer.
A subsegment of the array is a set of elements for some . We will denote such subsegment as .
Input Format: Each test consists of multiple test cases. The first line of each test case contains a single integer () — the number of test cases. The description of test cases follows.
The first line of each test case contains a single integer () — the length of the array .
The second line of each test case contains integers () — the elements of the array .
It is guaranteed that the sum of over all test cases does not exceed .
Output Format: For each test case, output a single integer — the smallest good integer.
Note: In the first test case, is a good integer, and it is the smallest one, since the integers appear in the array, which means that there are subsegments of the array of length with least common multiples of . However, it is impossible to find a subsegment of the array with a least common multiple equal to .
In the second test case, is a good integer. The integers appear explicitly in the array, and the integer is the least common multiple of the subsegments and .
In the third test case, is a good integer, since the least common multiples for the integer in the subsegments are , respectively.