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.io.*;
import java.lang.*;
import java.util.*;

public class C {
    private static void solve() throws IOException {
        //Solve here
        int n = sc.nextInt();
        long[] ar = new long[n];
        for (int i = 0; i < n; i++) {
            ar[i] = sc.nextLong();
        }
        boolean c1 = true, c2 = true;
        long gcdo = ar[1], gcde = ar[0];
        for (int i = 2; i < n; i++) {
            if (i % 2 == 0) {
                gcde = gcd(ar[i], gcde);
                if (gcde == 1) c1 = false;
            } else if (i % 2 != 0) {
                gcdo = gcd(ar[i], gcdo);
                if (gcdo == 1) c2 = false;
            }
        }


        boolean c = true;
        for (int i = 1; i < n && c && gcde!=1; i++) {
            if (ar[i] % gcde == 0 && ar[i - 1] % gcde == 0) c = false;
        }
        if (c &&gcde!=1) {
            ans.append(gcde+"\n");return;
        }
        for (int i = 1; i < n && c && gcdo!=1; i++) {
            if (ar[i] % gcdo == 0 && ar[i - 1] % gcdo == 0) c = false;
        }
        if (c && gcdo!=1) {
            ans.append(gcdo + "\n");
        }
        else ans.append(0 + "\n");


    }

    public static void main(String[] args) throws IOException {
        int t = sc.nextInt();
        while (t-- > 0) {
            solve();
        }
        System.out.println(ans);
    }

    static final FastReader sc = new FastReader();
    static StringBuilder ans = new StringBuilder();
    static boolean[] prime;
    static int M = 1_000_000_007;

    static long nCk(int n, int k) {
        return (modMult(fact(n), power(modMult(fact(n - k), fact(k)), M - 2)));
    }

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

    static long fact(long n) {

        long fact = 1;
        for (int i = 1; i <= n; i++) {
            fact = modMult(fact, i);
        }
        return fact % M;
    }

    static long modMult(long a, long b) {
        return a * b % M;
    }

    static long power(long x, long y) {
        long res = 1;
        x = x % M;
        if (x == 0)
            return 0;
        while (y > 0) {
            if ((y & 1) != 0)
                res = (res * x) % M;
            y = y >> 1;
            x = (x * x) % M;
        }
        return res;
    }

    static void sieveOfEratosthenes(int n) {
        prime = new boolean[n + 1];
        for (int i = 0; i <= n; i++)
            prime[i] = true;
        prime[0] = false;
        if (1 <= n)
            prime[1] = false;
        for (int p = 2; p * p <= n; p++) {

            if (prime[p]) {

                for (int i = p * p; i <= n; i += p)
                    prime[i] = false;
            }
        }
    }

    static int[] arrayIn(int n) throws IOException {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        return arr;
    }

    static class Pair<E, F> {
        private E v1;
        private F v2;

        Pair(E v1, F v2) {
            this.v1 = v1;
            this.v2 = v2;
        }

        Pair() {
        }
    }

    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());
        }

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