← Home
package main

import (
	"bytes"
	"io"
	"os"
	"strconv"
)

func gcd(a, b int64) int64 {
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func main() {
	data, _ := io.ReadAll(os.Stdin)
	idx := 0
	nextInt := func() int64 {
		for idx < len(data) && (data[idx] < '0' || data[idx] > '9') {
			idx++
		}
		var x int64
		for idx < len(data) && data[idx] >= '0' && data[idx] <= '9' {
			x = x*10 + int64(data[idx]-'0')
			idx++
		}
		return x
	}

	t := int(nextInt())
	var out bytes.Buffer

	for ; t > 0; t-- {
		n := int(nextInt())
		prev := nextInt()
		ans := int64(1)

		for i := 1; i < n; i++ {
			cur := nextInt()
			if cur%prev != 0 {
				d := prev / gcd(prev, cur)
				ans = ans / gcd(ans, d) * d
			}
			prev = cur
		}

		out.WriteString(strconv.FormatInt(ans, 10))
		out.WriteByte('\n')
	}

	os.Stdout.Write(out.Bytes())
}