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.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class A3 {

    void solve() {
        int n = cint();
        long[] a = carr_long(n);
        
        long gcd1 = a[0];
        long gcd2 = a[1];

        for (int i = 2; i < n; i+=2) {
            gcd1 = gcd(gcd1, a[i]);
        }
        for (int i = 3; i < n; i+=2) {
            gcd2 = gcd(gcd2, a[i]);
        }
        
        for (int i = 1; i < n; i+=2) {
            if (a[i] % gcd1 == 0) {
                gcd1 = 0;
                break;
            }
        }

        for (int i = 0; i < n; i+=2) {
            if (a[i] % gcd2 == 0) {
                gcd2 = 0;
                break;
            }
        }
        
        cout(Math.max(gcd1, gcd2));
    }

    long gcd(long a, long b) {
        while (b != 0) {
            long t = b;
            b = a % b;
            a = t;
        }
        return a;
    }

    public static void main(String... args) {
        int t = in.nextInt();
        for (int test = 0; test < t; test++) {
            new A3().solve();
        }
        out.flush();
    }

    static final QuickReader in = new QuickReader(System.in);
    static final PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out, 131_072));

    static int cint() {
        return in.nextInt();
    }

    static long clong() {
        return in.nextLong();
    }

    static String cstr() {
        return in.nextLine();
    }

    static int[] carr_int(int n) {
        return in.nextInts(n);
    }

    static long[] carr_long(int n) {
        return in.nextLongs(n);
    }

    static void cout(int... a) {
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < a.length; i++) {
            if (i != 0) {
                buf.append(' ');
            }
            buf.append(a[i]);
        }
        out.println(buf);
    }

    static void cout(long... a) {
        StringBuilder buf = new StringBuilder();
        for (int i = 0; i < a.length; i++) {
            if (i != 0) {
                buf.append(' ');
            }
            buf.append(a[i]);
        }
        out.println(buf);
    }

    static void cout(Object o) {
        out.println(o);
    }

    static class QuickReader {
        BufferedReader in;
        StringTokenizer token;

        public QuickReader(InputStream ins) {
            in = new BufferedReader(new InputStreamReader(ins));
            token = new StringTokenizer("");
        }

        public boolean hasNext() {
            while (!token.hasMoreTokens()) {
                try {
                    String s = in.readLine();
                    if (s == null) {
                        return false;
                    }
                    token = new StringTokenizer(s);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return true;
        }

        public String next() {
            hasNext();
            return token.nextToken();
        }

        public String nextLine() {
            try {
                String s = in.readLine();
                token = new StringTokenizer("");
                return s;
            } catch (IOException e) {
                throw new InputMismatchException();
            }
        }

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

        public int[] nextInts(int n) {
            int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

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

        public long[] nextLongs(int n) {
            long[] res = new long[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextLong();
            }
            return res;
        }
    }
}
