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.util.*;
	import java.io.*;
	import java.math.*;
	
	    public class Main {
	
	        // -- static variables --- //
	        static FastReader sc = new FastReader();
	        static PrintWriter out = new PrintWriter(System.out);
	        static int mod = (int) 1000000007;
	        public static void main(String[] args) throws Exception {
	         
	            int t=sc.nextInt();
	            while(t-->0)
	            Main.go();
	//             out.println();
	            out.flush();
	        }
	
	        // >>>>>>>>>>>>>>>>>>> Code Starts <<<<<<<<<<<<<<<<<<<< //
	        static class pair{
	            int  x;int y;
	            pair(int  x,int y){
	                this.x=x;
	                this.y=y;
	            }
							@Override
							public int hashCode() {
								final int prime = 31;
								int result = 1;
								result = prime * result + x;
								result = prime * result + y;
								return result;
							}
							@Override
							public boolean equals(Object obj) {
								if (this == obj)
									return true;
								if (obj == null)
									return false;
								if (getClass() != obj.getClass())
									return false;
								pair other = (pair) obj;
								if (x != other.x)
									return false;
								if (y != other.y)
									return false;
								return true;
							}
	            
	        }


	        static void go() throws Exception {
	        	int n=sc.nextInt();
	        	long a[]=sc.longArray(n);
	        	long fchoice=a[0];
	        	boolean f=false;
	        	for(int i=1;i<n;i++) {
	        		if(i%2!=0) {
	        			if(a[i]%fchoice==0) {
	        				f=true;
	        				break;
	        			}
	        		}else {
	        			if(a[i]%fchoice!=0) {
	        				f=true;break;
	        			}
	        		}
	        	}
	        	if(f==false) {
	        		out.println(fchoice);
	        		return;
	        	}
	        		long schoice=a[1];
	        		f=false;
	          	for(int i=0;i<n;i++) {
	          
		        		if(i%2==0) {
		        			if(a[i]%schoice==0) {
		        				f=true;
		        				break;
		        			}
		        		}else {
		        			if(a[i]%schoice!=0) {
		        				f=true;break;
		        			}
		        		}
	          	}
	          	if(f==false) {
	          		out.println(schoice);
	          		return;
	          	}
	          	out.println(0);
	        	
	        }
	        static long lcm(long a,long b) {
	        	return a*b/gcd(a,b);
	        }
	     
	    
	        // >>>>>>>>>>> Code Ends <<<<<<<<< //
	
	        // --For Rounding--//
	        static double round(double value, int places) {
	
	            if (places < 0)
	                throw new IllegalArgumentException();
	            BigDecimal bd = new BigDecimal(Double.toString(value));
	            bd = bd.setScale(places, RoundingMode.HALF_UP);
	            return bd.doubleValue();
	        }
	
	        // ----Greatest Common Divisor-----//
	        static long gcd(long a, long b) {
	            if (b == 0) {
	                return a;
	            }
	            return gcd(b, a % b);
	        }
	
	        // --- permutations and Combinations ---//
	        static long fact[];
	        static long invfact[];
	
	        static long ncr(int n, int k) {
	            if (k < 0 || k > n) {
	                return 0;
	            }
	            long x = fact[n];
	            long y = fact[k];
	            long yy = fact[n - k];
	            long ans = (x / y);
	            ans = (ans / yy);
	            return ans;
	        }
	
	        // ---sieve---//
	        static int prime[] = new int[1000006];
	
	        // static void sieve() {
	        //     Arrays.fill(prime, 1);
	        //     prime[0] = 0;
	        //     prime[1] = 0;
	        //     for (int i = 2; i * i <= 1000005; i++) {
	        //         if (prime[i] == 1)
	        //             for (int j = i * i; j <= 1000005; j += i) {
	        //                 prime[j] = 0;
	        //             }
	        //     }
	        // }
	
	        // ---- Manual sort ------//
	        static void sort(long[] a) {
	            ArrayList<Long> aa = new ArrayList<>();
	            for (long i : a) {
	                aa.add(i);
	            }
	            Collections.sort(aa);
	            for (int i = 0; i < a.length; i++)
	                a[i] = aa.get(i);
	        }
	
	        static void sort(int[] a) {
	            ArrayList<Integer> aa = new ArrayList<>();
	            for (int i : a) {
	                aa.add(i);
	            }
	            Collections.sort(aa);
	            for (int i = 0; i < a.length; i++)
	                a[i] = aa.get(i);
	        }
	
	        // --- Fast exponentiation ---//
	        static long pow(long x, long y) {
	            long res = 1l;
	            while (y != 0) {
	                if (y % 2 == 1) {
	                    res = (x * res)%mod;
	                }
	                y /= 2;
	                x = (x * x)%mod;
	            }
	            return res;
	        }
	
	        // >>>>>>>>>>>>>>> Fast IO <<<<<<<<<<<<<< //
	        static class FastReader {
	            BufferedReader br;
	            StringTokenizer st;
	
	            public FastReader() {
	                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());
	            }
	
	            int[] intArray(int n) {
	                int a[] = new int[n];
	                for (int i = 0; i < n; i++)
	                    a[i] = sc.nextInt();
	                return a;
	            }
	
	            long[] longArray(int n) {
	                long a[] = new long[n];
	                for (int i = 0; i < n; i++)
	                    a[i] = sc.nextLong();
	                return a;
	            }
	
	            String nextLine() {
	                String str = "";
	                try {
	                    str = br.readLine();
	                } catch (IOException e) {
	                    e.printStackTrace();
	                }
	                return str;
	            }
	        }
	    }