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

  /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigInteger;
 
 
 
 
 
public class hello{
 
   static class Pair implements Comparable<Pair>{
 
    long val;
    long ind;
    public Pair(long val,long ind)
    {
        this.val=val;
        this.ind=ind;
    }
 
    public int compareTo(Pair o)
    {
        return Long.compare(this.val, o.val);
}
}
     static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            try {
               br=new BufferedReader(new FileReader("input.txt"));
               PrintStream out= new PrintStream(new FileOutputStream("output.txt"));
               System.setOut(out);
            }
  
            // Catch block to handle the exceptions
            catch (Exception e) {
                br=new BufferedReader(new InputStreamReader(System.in));
            }
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
     static int computeXOR(int n)
    {
        // If n is a multiple of 4
        if (n % 4 == 0)
            return n;
      
        // If n%4 gives remainder 1
        if (n % 4 == 1)
            return 1;
      
        // If n%4 gives remainder 2
        if (n % 4 == 2)
            return n + 1;
      
        // If n%4 gives remainder 3
        return 0;
    }
    static long helper(List<Long> l,long k)
    {
        int length = l.size()-1;
        long val = 0;

        while(length>=0)
        {
            val+=2*(l.get(length));
            length-=k;
        }

        return val;
    }

   static long findGCD(long a, long b){
    if(b == 0)
      return a;
    return findGCD(b, a%b);
}
    public static void main (String[] args) throws java.lang.Exception
    {
 
       try{
        FastReader sc=new FastReader();
        BufferedWriter out = new BufferedWriter(
            new OutputStreamWriter(System.out));
        int t = sc.nextInt();
        while(t-->0)
        {
            int n = sc.nextInt();
            long arr[] = new long[n];
            for(int i=0;i<n;i++)
            {
                arr[i] = sc.nextLong();
            }

            long gcd = arr[0];
 
    //Reuse the previous calculated GCD value
          for(int i=2; i<n; i++){
        gcd = findGCD(arr[i], gcd);
        i++;
        }

        long gcd2 = arr[1];

        for(int i=3;i<n;i++)
        {
            gcd2 = findGCD(arr[i],gcd2);
            i++;
        }


        if(gcd==1&&gcd2==1)
            System.out.println(0);
        else{

            boolean yes1=true;
            boolean yes2=true;

            for(int i=1;i<n;i++)
            {
                if(arr[i]%gcd == 0)
                {
                    yes1=false;
                    break;
                }
                i++;
            }

            for(int i=0;i<n;i++)
            {
                if(arr[i]%gcd2==0)
                {
                    yes2=false;
                    break;
                }
                i++;
            }

            if(yes1||yes2)
            {
                if(yes1)
                    System.out.println(gcd);
                else
                    System.out.println(gcd2);
            }
            else
            {
                System.out.println(0);
            }
        }


        }
    }catch(Exception e){
            return;
        }
    }
}