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.BigInteger;
import java.nio.charset.StandardCharsets;
	
public class Main {
		private static FS sc = new FS();
		
		private static class FS {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			StringTokenizer st = new StringTokenizer("");
			String next() {
				while (!st.hasMoreTokens())
					try {
						st=new StringTokenizer(br.readLine());				               
		            } catch (IOException e) {}
				return st.nextToken();
			}
			
			int nextInt() {
				return Integer.parseInt(next());
			}
			long nextLong() {
				return Long.parseLong(next());
			}
		}
		
		private static class extra {
			
			static int[] intArr(int size) {
				int[] a = new int[size];
				for(int i = 0; i < size; i++) a[i] = sc.nextInt();
				return a;
			}
			
			static long[] longArr(int size) {
				Scanner scc = new Scanner(System.in);
				long[] a = new long[size];
				for(int i = 0; i < size; i++) a[i] = sc.nextLong();
				return a;
			}
			
			static long intSum(int[] a) {
				long sum = 0; 
				for(int i = 0; i < a.length; i++) {
					sum += a[i];
				}
				return sum;
			}
			
			static long longSum(long[] a) {
				long sum = 0; 
				for(int i = 0; i < a.length; i++) {
					sum += a[i];
				}
				return sum;
			}
			
			static LinkedList[] graphD(int vertices, int edges) {
				LinkedList<Integer>[] temp = new LinkedList[vertices+1];
				for(int i = 0; i <= vertices; i++) temp[i] = new LinkedList<>();
				for(int i = 0; i < edges; i++) {
					int x = sc.nextInt();
					int y = sc.nextInt();
					temp[x].add(y);
				}
				return temp;
			}
			
			static LinkedList[] graphUD(int vertices, int edges) {
				LinkedList<Integer>[] temp = new LinkedList[vertices+1];
				for(int i = 0; i <= vertices; i++) temp[i] = new LinkedList<>();
				for(int i = 0; i < edges; i++) {
					int x = sc.nextInt();
					int y = sc.nextInt();
					temp[x].add(y);
					temp[y].add(x);
				}
				return temp;
			}
			
			static void printG(LinkedList[] temp) {
				for(LinkedList<Integer> aa:temp) System.out.println(aa);
			}
			
			static long cal(long val, long pow, long mod) {
				if(pow == 0) return 1;
				long res = cal(val, pow/2, mod);
				
				long ret = (res*res)%mod;
				if(pow%2 == 0) return ret;
				return (val*ret)%mod;
			}
			
			static long gcd(long a, long b) { return b == 0 ? a:gcd(b, a%b); }
			
		}
		
		static int mod = (int) 1e9 + 7;
		
		static LinkedList<Integer>[] temp, idx;
		static long inf = (long) Long.MAX_VALUE;
//		static long inf = Long.MAX_VALUE;
		static int max;
		
		public static void main(String[] args) { 
			int t = sc.nextInt();
//			int t = 1;
			StringBuilder ret = new StringBuilder();
			while(t-- > 0) {
//				int n = sc.nextInt();
//				ArrayList<String> a = new ArrayList<>();
//				for(int i = 0; i < n-2; i++) a.add(sc.next());
//				String missing = "";
//				int idx = -1;
//				for(int i = 0; i < n-3; i++) {
//					if(a.get(i).charAt(1) != a.get(i+1).charAt(0)) {
//						missing += a.get(i).charAt(1);
//						missing += a.get(i+1).charAt(0);
//						idx = i;
//						break;
//					}
//				}
//				if(missing.equals("")) {
//					missing += a.get(a.size()-1).charAt(1);
//					missing += 'b';
//					idx = n-2;
//				}
//				StringBuilder out = new StringBuilder();
//				for(int i = 0; i < idx; i++) {
//					out.append(a.get(i).charAt(0));
//				}
//				if(idx != n-2) out.append(missing.charAt(0));
//				for(int i = idx; i < n-2; i++) out.append(a.get(i).charAt(0));
//				if(idx != n-2) out.append(a.get(n-3).charAt(1));
//				else out.append(missing);
//				ret.append(out + "\n");
				int n = sc.nextInt();
				long[] a = extra.longArr(n);
				ArrayList<Long> arr1 = new ArrayList<>(), arr2 = new ArrayList<>();
				for(int i = 0; i < n; i += 2) arr1.add(a[i]);
				for(int i = 1; i < n; i += 2) arr2.add(a[i]);
				long gcd1 = 0, gcd2 = 0;
				for(long aa:arr1) gcd1 = extra.gcd(aa, gcd1);
				for(long aa:arr2) gcd2 = extra.gcd(aa, gcd2);
				if(gcd1 != 1 && gcd2 != 1) {
					int flag = 0;
					for(long aa:arr1) if(aa%gcd2 == 0) {
						flag++;
						break;
					}
					if(flag == 0) {
						ret.append(gcd2 + "\n");
						continue;
					}
					for(long aa:arr2) if(aa%gcd1 == 0) {
						flag++;
						break;
					}
					if(flag == 1) {
						ret.append(gcd1 + "\n");
					} else ret.append(0 + "\n");
				} else if(gcd2 != 1) {
					int flag = 0;
					for(long aa:arr1) if(aa%gcd2 == 0) flag = 1;
					if(flag == 1) ret.append(0 + "\n");
					else ret.append(gcd2 + "\n");
				} else if(gcd1 != 1) {
					int flag = 0;
					for(long aa:arr2) if(aa%gcd1 == 0) flag = 1;
					if(flag == 1) ret.append(0 + "\n");
					else ret.append(gcd1 + "\n");
				} else ret.append(0 + "\n");
			}
			System.out.println(ret);
		}
		
		
		
	}

	
	


	
	
	
