← Home
```go
package main

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

var data []byte
var idx int

func nextInt() int {
	sign := 1
	for idx < len(data) && (data[idx] < '0' || data[idx] > '9') && data[idx] != '-' {
		idx++
	}
	if idx < len(data) && data[idx] == '-' {
		sign = -1
		idx++
	}
	n := 0
	for idx < len(data) && data[idx] >= '0' && data[idx] <= '9' {
		n = n*10 + int(data[idx]-'0')
		idx++
	}
	return sign * n
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	data, _ = io.ReadAll(os.Stdin)
	t := nextInt()
	var out bytes.Buffer

	for ; t > 0; t-- {
		n := nextInt()
		m := nextInt()
		k := nextInt()

		a := make([]int, n)
		for i := 0; i < n; i++ {
			a[i] = nextInt()
		}

		p := m - 1
		if k > p {
			k = p
		}
		u := p - k

		ans := 0
		for i := 0; i <= k; i++ {
			cur := 1 << 30
			for j := 0; j <= u; j++ {
				x := i + j
				v := max(a[x], a[n-m+x])
				if v < cur {
					cur = v
				}
			}
			if cur > ans {
				ans = cur
			}
		}

		out.WriteString(strconv.Itoa(ans))
		out.WriteByte('\n')
	}

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