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

//<———My cp————
import java.util.*;
import java.io.*;

public class C_Paint_the_Array{
    public static void main(String[] args) throws Exception{
        FastReader fr = new FastReader(System.in);
        int t = fr.nextInt();
        while(t-->0){
            int l = fr.nextInt();
            long[] vals = new long[l];

            for(int i = 0;i<l;i++){
                vals[i] = fr.nextLong(); 
            }

            long oddPlaceGcd = 0;
            long evenPlaceGcd = 0;
            for(int i = 0;i<l;i++){
                if(i%2==1){
                    oddPlaceGcd = GCD(oddPlaceGcd,vals[i]);
                }
                if(i%2==0){
                    evenPlaceGcd = GCD(evenPlaceGcd, vals[i]);
                }
            }

            boolean oddHoldTrue = true;
            boolean evenHoldTrue = true;
            for(int i =0;i<l;i++){
                if(i%2==0){
                    if(vals[i]%oddPlaceGcd==0){
                        oddHoldTrue = false;
                    }
                }
                if(i%2==1){
                    if(vals[i]%evenPlaceGcd==0){
                        evenHoldTrue = false;
                    }
                }                
            }

            if(oddHoldTrue){
                println(oddPlaceGcd);
            }else if(evenHoldTrue){
                println(evenPlaceGcd);
            }else{
                println(0);
            }



        }
        
    }

    public static void print(Object val){
        System.out.print(val);
    }


    public static void println(Object val){
        System.out.println(val);
    }



    public static int[] sort(int[] vals){
        ArrayList<Integer> values = new ArrayList<>();
        for(int i = 0;i<vals.length;i++){
            values.add(vals[i]);
        }
        Collections.sort(values);

        for(int i =0;i<values.size();i++){
            vals[i] = values.get(i);
        }
        return vals;
    }



    public static long[] sort(long[] vals){
        ArrayList<Long> values = new ArrayList<>();
        for(int i = 0;i<vals.length;i++){
            values.add(vals[i]);
        }
        Collections.sort(values);
        for(int i =0;i<values.size();i++){
            vals[i] = values.get(i);
        }
        return vals;
    }

    static class FastReader{
     
        byte[] buf = new byte[2048];
        int index, total;
        InputStream in;
 
        FastReader(InputStream is) {
            in = is;
        }

        int scan() throws IOException {
            if (index >= total) {
                index = 0;
                total = in.read(buf);
                if (total <= 0) {
                    return -1;
                }
            }
            return buf[index++];
        }
 
        String next() throws IOException {
            int c;
            for (c = scan(); c <= 32; c = scan());
            StringBuilder sb = new StringBuilder();
            for (; c > 32; c = scan()) {
                sb.append((char) c);
            }
            return sb.toString();
        }
 
        int nextInt() throws IOException {
            int c, val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
 
        long nextLong() throws IOException {
            int c;
            long val = 0;
            for (c = scan(); c <= 32; c = scan());
            boolean neg = c == '-';
            if (c == '-' || c == '+') {
                c = scan();
            }
            for (; c >= '0' && c <= '9'; c = scan()) {
                val = (val << 3) + (val << 1) + (c & 15);
            }
            return neg ? -val : val;
        }
    }

    public static int GCD(int numA, int numB){
        if(numA==0){
            return numB;
        }else if(numB==0){
            return numA;
        }else{
            if(numA>numB){
                return GCD(numA%numB,numB);
            }else{
                return GCD(numA,numB%numA);
            }
        }
    }
    public static long GCD(long numA,long numB){
        if(numA==0){
            return numB;
        }else if(numB==0){
            return numA;
        }else{
            if(numA>numB){
                return GCD(numA%numB,numB);
            }else{
                return GCD(numA,numB%numA);
            }
        }
    }
}
//https://codeforces.com/problemset/problem/1541/B