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

/*
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
 
*/

import java.util.*;
import java.math.*;
import java.io.*;
import java.lang.Math.*;

public class KickStart2020 {
	 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());
		}

		float nextFloat() {
			return Float.parseFloat(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	static long gcd(long a, long b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);

	}
	static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static class Pair implements Comparable<Pair> {
		public int index;
		public String value;

		public Pair(int index,String value) {
			this.index = index;
			this.value = value;
		}

		@Override
		public int compareTo(Pair other) {
			// multiplied to -1 as the author need descending sort order
			if(other.index < this.index) return -1;
			if(other.index > this.index) return 1;
			return 0;
		}
		@Override
		public String toString() {
			return this.index + " " + this.value;
		}
	}
	static boolean isPrime(long d) {
		if (d == 3)
			return false;
		for (int i = 2; i <= (long) Math.sqrt(d); i++) {
			if (d % i == 0)
				return false;
		}
		return true;
	}
	static void decimalTob(int n, int k, Stack<Integer> ss) {
          int x = n % k;
          int y = n / k;
          ss.push(x);
          if(y > 0) {
        	   decimalTob(y, k, ss);
          }
	}
	static long powermod(long x, long y, long mod) {
		long ans = 1;
		x = x % mod;
		if (x == 0)
			return 0;
		int i = 1;
		while (y > 0) {
			if ((y & 1) != 0)
				ans = (ans * x) % mod;
			y = y >> 1;
			x = (x * x) % mod;
		}
		return ans;
	}
	static long power(long x, long y)
	{
	    long res = 1;
	    while (y > 0)
	    {
	        if ((y & 1) != 0)
	            res = res * x;	  
	        y = y >> 1; 
	        x = x * x;  
	    }
	    return res;
	}
	static boolean check(char a[], char b[]) {
		for(int i = 0; i < Math.min(a.length, b.length); i++) {
			if(a[i] < b[i]) return true;
			else if(a[i] > b[i]) return false;
		}
		if(a.length < b.length) return true;
		return false;
	}
	public static void main(String[] args) throws Exception {
		FastReader sc = new FastReader();
		PrintWriter out = new PrintWriter(System.out);
		int t = sc.nextInt();
		outerloop:
			while(t-- > 0) {
               int n = sc.nextInt();
               long arr[] = new long[n];
               for(int i = 0; i < n; i++) arr[i] = sc.nextLong();
               long gcd1 = 0;
               long gcd2 = 0;
               for(int i = 0; i < n; i+= 2) gcd1 = gcd(gcd1, arr[i]);
               for(int i = 1; i < n; i+= 2) gcd2 = gcd(gcd2, arr[i]);
               boolean hachu = true;
               for(int i = 1; i < n; i+= 2) {
            	   if(arr[i] % gcd1 == 0) {
            		   hachu = false;
            		   break;
            	   }
               }
               if(hachu) {
            	   out.println(gcd1);
            	   continue outerloop;
               }
               for(int i = 0; i < n; i+=2) {
            	   if(arr[i] % gcd2 == 0) {
            		   out.println(0);
            		   continue outerloop;
            	   }
               }
               out.println(gcd2);
			}
		out.close();
	}
}