```go
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
scanner.Split(bufio.ScanWords)
readInt := func() int {
scanner.Scan()
x, _ := strconv.Atoi(scanner.Text())
return x
}
t := readInt()
for tc := 0; tc < t; tc++ {
n := readInt()
m := n*n + 1
q1 := make([]int, n+1)
for i := 0; i <= n; i++ {
q1[i] = i + 1
}
res1 := query(scanner, q1)
if len(res1) >= n+1 {
answer(res1[:n+1])
continue
}
v := res1
k := len(v)
gapResults := make([][]int, 0)
for i := 0; i < k; i++ {
L := v[i] + 1
var R int
if i+1 < k {
R = v[i+1] - 1
} else {
R = m
}
if L > R {
gapResults = append(gapResults, []int{})
continue
}
q := make([]int, R-L+1)
for j := L; j <= R; j++ {
q[j-L] = j
}
res := query(scanner, q)
gapResults = append(gapResults, res)
}
ans := []int{v[0]}
for i := 0; i < len(gapResults) && len(ans) < n+1; i++ {
if len(gapResults[i]) > 0 {
ans = append(ans, gapResults[i][0])
}
}
if len(ans) < n+1 {
for i := len(gapResults) - 1; i >= 0 && len(ans) < n+1; i-- {
for j := 1; j < len(gapResults[i]) && len(ans) < n+1; j++ {
ans = append(ans, gapResults[i][j])
}
}
}
answer(ans)
}
}
func query(scanner *bufio.Scanner, q []int) []int {
if len(q) == 0 {
return []int{}
}
fmt.Print("?", len(q))
for _, x := range q {
fmt.Print(" ", x)
}
fmt.Println()
os.Stdout.Sync()
scanner.Scan()
line := scanner.Text()
parts := strings.Split(line, " ")
if parts[0] == "-1" {
os.Exit(0)
}
c, _ := strconv.Atoi(parts[0])
res := make([]int, c)
for i := 0; i < c; i++ {
res[i], _ = strconv.Atoi(parts[i+1])
}
return res
}
func answer(ans []int) {
fmt.Print("!")
for _, x := range ans {
fmt.Print(" ", x)
}
fmt.Println()
os.Stdout.Sync()
}
```