You are given an array a consisting of n positive integers. You have to choose a positive integer d and paint all elements into two colors. All elements which are divisible by d will be painted red, and all other elements will be painted blue.

The coloring is called beautiful if there are no pairs of adjacent elements with the same color in the array. Your task is to find any value of d which yields a beautiful coloring, or report that it is impossible.

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of testcases.

The first line of each testcase contains one integer n (2 ≤ n ≤ 100) — the number of elements of the array.

The second line of each testcase contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 10^{18}).

Output

For each testcase print a single integer. If there is no such value of d that yields a beautiful coloring, print 0. Otherwise, print any suitable value of d (1 ≤ d ≤ 10^{18}).

Example

Input


5
5
1 2 3 4 5
3
10 5 15
3
100 10 200
10
9 8 2 6 6 2 8 6 5 4
2
1 3


Output


2
0
100
0
3
1
5
6 5 12 5 16
 1
5
3 5 6 11 2

2
 0

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.lang.reflect.Array;
import java.util.*;
import java.util.stream.Stream;

public class Program {

    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws NumberFormatException, IOException {

        int cases = Integer.parseInt(reader.readLine());
        int mod = 998244353;

        while(cases-- > 0) {

            String[] firstLine = reader.readLine().split(" ");
            int n = Integer.parseInt(firstLine[0]);
            long[] arr = convertToLongPrimitiveArray(reader.readLine().split(" "));
            long hcf1 = 0;
            long hcf2 = 0;

            for(int i=0;i<arr.length;i+=2) {
                hcf1 = hcf(hcf1, arr[i]);
            }

            for(int i=1;i<arr.length;i+=2) {
                hcf2 = hcf(hcf2, arr[i]);
            }
            boolean poss = true;
            long ans = 0;
            for(int i=0;i<arr.length;i+=2) {
                if(arr[i]%hcf2 == 0) {
                    poss = false;
                    break;
                }
            }

            if(poss) {
                ans = hcf2;
            }
            poss = true;
            for(int i=1;i<arr.length;i+=2) {
                if(arr[i]%hcf1 == 0) {
                    poss = false;
                    break;
                }
            }

            if(poss) {
                ans = hcf1;
            }

           printNumber(ans);


        }

        out.flush();

    }

    public static int[] convertToIntPrimitiveArray(String[] str) {
        return Stream.of(str).mapToInt(Integer::parseInt).toArray();
    }

    public static Integer[] convertToIntArray(String[] str) {
        Integer[] arr = new Integer[str.length];
        for(int i=0;i<str.length;i++) {
            arr[i] = Integer.parseInt(str[i]);
        }
        return arr;
    }

    public static Long[] convertToLongArray(String[] str) {
        Long[] arr = new Long[str.length];
        for(int i=0;i<str.length;i++) {
            arr[i] = Long.parseLong(str[i]);
        }
        return arr;
    }

    public static long[] convertToLongPrimitiveArray(String[] str) {
        return Stream.of(str).mapToLong(Long::parseLong).toArray();
    }

    public static void printYes() throws IOException {
        out.append("YES" + "\n");
    }

    public static void printNo() throws IOException {
        out.append("NO" + "\n");
    }

    public static void printNumber(long num) throws IOException {
        out.append(num + "\n");
    }

    public static long hcf(long a, long b) {
        if(b==0) return a;
        return hcf(b, a%b);
    }

    public static int findSet(int[] parent, int[] rank, int v) {
        if(v==parent[v]) {
            return v;
        }
        parent[v] = findSet(parent, rank, parent[v]);
        return parent[v];
    }

    public static void unionSet(int[] parent, int[] rank, int a, int b) {

        a = findSet(parent, rank, a);
        b = findSet(parent, rank, b);

        if(a == b) {
            return;
        }

        if(rank[a] < rank[b]) {
            int temp = a;
            a = b;
            b = temp;
        }

        parent[b] = a;
        if(rank[a] == rank[b]) {
            rank[a]++;
        }

    }

    public static void makeSet(int[] parent, int[] rank, int v) {
        parent[v] = v;
        rank[v] = 0;
    }

    public static long modularDivision(long a, long b, int mod) {
        if(a==0) return 1;
        a %= mod;
        long res = 1L;
        while(b > 0) {
            if((b&1)==1) {
                res = (res * a)%mod;
            }
            a = (a*a)%mod;
            b >>= 1;
        }
        return res;
    }

    public static void customSort(int[] arr) {
        int n = arr.length;
        Random rnd = new Random();
        for(int i=0; i<n; ++i){
            int tmp = arr[i];
            int randomPos = i + rnd.nextInt(n-i);
            arr[i] = arr[randomPos];
            arr[randomPos] = tmp;
        }
        Arrays.sort(arr);
        return;
    }

    public static long[] factorial(int n, int mod) {
        long[] fact = new long[n+1];
        fact[0] = 1;
        for(int i=1;i<fact.length;i++) {
            fact[i] = (i*fact[i-1] + mod)%mod;
        }
        return fact;
    }

}