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.*;

public class Solution {

	static int mod = 1000000007;

	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int t = fs.nextInt();
		while (t-- > 0) {
			int n = fs.nextInt();
			long[] a = new long[n];

			for (int i = 0; i < n; i++)
				a[i] = fs.nextLong();

			long gc = a[0];
			for (int i = 2; i < n; i += 2) {
				gc = gcd(gc, a[i]);
			}

			if (gc != 1) {
				boolean ch = true;
				for (int i = 1; i < n; i += 2) {
					if (a[i] % gc == 0) {
						ch = false;
						break;
					}
				}
				if (ch) {
					System.out.println(gc);
				} else {
					gc = a[1];
					if (n > 2) {
						for (int i = 3; i < n; i += 2) {
							gc = gcd(gc, a[i]);
						}
					}

					if (gc != 1) {
						ch = true;
						for (int i = 0; i < n; i += 2) {
							if (a[i] % gc == 0) {
								ch = false;
								break;
							}
						}

						if (ch)
							System.out.println(gc);
						else
							System.out.println(0);
					} else {
						System.out.println(0);
					}
				}
			} else {
				gc = a[1];
				for (int i = 3; i < n; i += 2) {
					gc = gcd(gc, a[i]);
				}

				if (gc != 1) {
					boolean ch = true;
					for (int i = 0; i < n; i += 2) {
						if (a[i] % gc == 0) {
							ch = false;
							break;
						}
					}
					if (ch)
						System.out.println(gc);
					else
						System.out.println(0);
				} else {
					System.out.println(0);
				}
			}

		}
	}

	static boolean isPrime(int n) {
		if (n <= 1)
			return false;
		else if (n == 2)
			return true;

		else if (n % 2 == 0)
			return false;

		for (int i = 3; i <= Math.sqrt(n); i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}

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

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

	static void sort(int[] a) {
		// suffle
		int n = a.length;
		Random r = new Random();
		for (int i = 0; i < a.length; i++) {
			int oi = r.nextInt(n);
			int temp = a[i];
			a[i] = a[oi];
			a[oi] = temp;
		}

		// then sort
		Arrays.sort(a);
	}

	// Use this to input code since it is faster than a Scanner
	static class FastScanner {
		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) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		ArrayList<Integer> readList(int n) {
			ArrayList<Integer> list = new ArrayList<>();
			for (int i = 0; i < n; i++)
				list.add(nextInt());
			return list;
		}
	}

}
