//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;

#define prec setprecision

typedef long long ll;
typedef unsigned long long llu;
template<typename T> T gcd(T m, T n) {while(n) {T t=m%n; m=n;n=t;};return m;}
template<typename T> T exgcd(T a, T b, T& sa, T& ta) {T q, r, sb=0, tb=1, sc, tc; sa=1,ta=0; if(b) do q = a/b, r = a-q*b, a = b, b = r, sc = sa-q*sb, sa = sb, sb = sc, tc = ta-q*tb, ta = tb, tb = tc; while(b); return a; }
template<typename T> T mul_inv(T a, T b) { T t1 = a, t2 = b, t3; T v1 = 1, v2 = 0, v3; T x; while (t2 != 1) x = t1/t2, t3 = t1 - x*t2, v3 = v1 - x*v2, t1 = t2, t2 = t3, v1 = v2, v2 = v3; return (v2 + b) % b; }
template<typename T> T powmod(T a, T b, T MOD) {if (b < 0) return 0; T rv = 1; while (b) (b % 2) && (rv = (rv*a) % MOD), a = a*a%MOD, b /= 2; return rv;}
template<ll n> struct BitSize{enum{Size=BitSize<n/2>::Size+1};};
template<> struct BitSize<0>{enum{Size=1};};
template<> struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define BITMAX(n) (BitSize<n>::Size - 1)

#ifndef ONLINE_JUDGE
#define DEBUG 1
#else
#define DEBUG 0
#endif

const int maxn = 5e5 + 7;
int n;
#define INPUT_CHECK (cin >> n)
int a[maxn];
pair<int, int> ap[maxn];
int nxt[maxn];
int prv[maxn];

int main(int argc, char *argv[]) {
	std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
	#if DEBUG
	freopen("/tmp/in.txt", "r", stdin);
	while(INPUT_CHECK)
	#else
	INPUT_CHECK;
	#endif
	{
		ll r = 0;
		for(int i=1;i<=n;i++) {
			int x; cin >> x;
			a[i] = x;
			ap[i] = {x, i};
		}
		a[0] = a[n+1] = 0;
		sort(ap+1, ap+n+1);
		for(int i=0;i<=n+1;i++) {
			nxt[i] = i+1;
			prv[i] = i-1;
		}
		for(int i=1;i<=n;i++) {
			int idx = ap[i].second;
			if(a[idx] <= a[prv[idx]] && a[idx] <= a[nxt[idx]]) {
				r += min(a[nxt[idx]], a[prv[idx]]);
				nxt[prv[idx]] = nxt[idx];
				prv[nxt[idx]] = prv[idx];
			}
		}
		for(int i=nxt[0];i<=n;i=nxt[i]) {
			r += min(a[prv[i]], a[nxt[i]]);
		}
		cout << r << endl;
	}
	return 0;
}


//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;

#define prec setprecision

typedef long long ll;
typedef unsigned long long llu;
template<typename T> T gcd(T m, T n) {while(n) {T t=m%n; m=n;n=t;};return m;}
template<typename T> T exgcd(T a, T b, T& sa, T& ta) {T q, r, sb=0, tb=1, sc, tc; sa=1,ta=0; if(b) do q = a/b, r = a-q*b, a = b, b = r, sc = sa-q*sb, sa = sb, sb = sc, tc = ta-q*tb, ta = tb, tb = tc; while(b); return a; }
template<typename T> T mul_inv(T a, T b) { T t1 = a, t2 = b, t3; T v1 = 1, v2 = 0, v3; T x; while (t2 != 1) x = t1/t2, t3 = t1 - x*t2, v3 = v1 - x*v2, t1 = t2, t2 = t3, v1 = v2, v2 = v3; return (v2 + b) % b; }
template<typename T> T powmod(T a, T b, T MOD) {if (b < 0) return 0; T rv = 1; while (b) (b % 2) && (rv = (rv*a) % MOD), a = a*a%MOD, b /= 2; return rv;}
template<ll n> struct BitSize{enum{Size=BitSize<n/2>::Size+1};};
template<> struct BitSize<0>{enum{Size=1};};
template<> struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define BITMAX(n) (BitSize<n>::Size - 1)

#ifndef ONLINE_JUDGE
#define DEBUG 1
#else
#define DEBUG 0
#endif

const int maxn = 5e5 + 7;
int n;
#define INPUT_CHECK (cin >> n)
int a[maxn];

int main(int argc, char *argv[]) {
	std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
	#if DEBUG
	freopen("/tmp/in.txt", "r", stdin);
	while(INPUT_CHECK)
	#else
	INPUT_CHECK;
	#endif
	{
		int an = 0;
		ll r = 0;
		for(int i=0;i<n;i++) {
			int x; cin >> x;
			while(an>=2 && a[an] <= x && a[an-1] >= a[an]) {
				r += min(a[an-1], x);
				an--;
			}
			a[++an] = x;
		}
		for(int i=1;i<an;i++) r += min(a[i-1], a[i+1]);
		cout << r << endl;
	}
	return 0;
}


//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")

// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
using namespace std;

#define prec setprecision

typedef long long ll;
typedef unsigned long long llu;
template<typename T> T gcd(T m, T n) {while(n) {T t=m%n; m=n;n=t;};return m;}
template<typename T> T exgcd(T a, T b, T& sa, T& ta) {T q, r, sb=0, tb=1, sc, tc; sa=1,ta=0; if(b) do q = a/b, r = a-q*b, a = b, b = r, sc = sa-q*sb, sa = sb, sb = sc, tc = ta-q*tb, ta = tb, tb = tc; while(b); return a; }
template<typename T> T mul_inv(T a, T b) { T t1 = a, t2 = b, t3; T v1 = 1, v2 = 0, v3; T x; while (t2 != 1) x = t1/t2, t3 = t1 - x*t2, v3 = v1 - x*v2, t1 = t2, t2 = t3, v1 = v2, v2 = v3; return (v2 + b) % b; }
template<typename T> T powmod(T a, T b, T MOD) {if (b < 0) return 0; T rv = 1; while (b) (b % 2) && (rv = (rv*a) % MOD), a = a*a%MOD, b /= 2; return rv;}
template<ll n> struct BitSize{enum{Size=BitSize<n/2>::Size+1};};
template<> struct BitSize<0>{enum{Size=1};};
template<> struct BitSize<1>{enum{Size=1};};
#define BITSIZE(n) (BitSize<n>::Size)
#define BITMAX(n) (BitSize<n>::Size - 1)

#ifndef ONLINE_JUDGE
#define DEBUG 1
#else
#define DEBUG 0
#endif

const int maxn = 5e5 + 7;
int n;
#define INPUT_CHECK (cin >> n)
int a[maxn];
pair<int, int> ap[maxn];
int nxt[maxn];
int prv[maxn];

int main(int argc, char *argv[]) {
	std::cin.sync_with_stdio(false);std::cin.tie(nullptr);
	#if DEBUG
	freopen("/tmp/in.txt", "r", stdin);
	while(INPUT_CHECK)
	#else
	INPUT_CHECK;
	#endif
	{
		ll r = 0;
		for(int i=0;i<n;i++) {
			int x; cin >> x;
			a[i+1] = x;
			ap[i+1] = {x, i+1};
		}
		a[0] = a[n+1] = 0;
		sort(ap+1, ap+n+1);
		memset(nxt,0,sizeof(nxt));
		memset(prv,0,sizeof(prv));
		for(int i=1;i<=n;i++) {
			nxt[i] = i+1;
			prv[i] = i-1;
		}
		nxt[0] = 1;
		prv[n+1] = n;
		for(int i=1;i<=n;i++) {
			int idx = ap[i].second;
			if(a[idx] < a[prv[idx]] && a[idx] < a[nxt[idx]]) {
				r += min(a[nxt[idx]], a[prv[idx]]);
				nxt[prv[idx]] = nxt[idx];
				prv[nxt[idx]] = prv[idx];
			}
		}
		for(int i=nxt[0];i<=n;i=nxt[i]) {
			r += min(a[prv[i]], a[nxt[i]]);
		}
		cout << r << endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define forn(i,n) for(int i=0;i<(int)(n);i++)
#define si(c) ((int)(c).size())
#define forsn(i,s,n) for(int i = (int)(s); i<((int)n); i++)
#define dforsn(i,s,n) for(int i = (int)(n)-1; i>=((int)s); i--)
#define all(c) (c).begin(), (c).end()
#define D(a) cerr << #a << "=" << (a) << endl;
#define pb push_back
#define eb emplace_back
#define mp make_pair

typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

set<pii> valpos, posval;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int n; cin >> n;
    forn(i,n) {
        int x; cin >> x;
        valpos.emplace(x,i);
        posval.emplace(i,x);
    }

    ll ans = 0;
    while (valpos.size() > 2) {
        int v,p; tie(v,p) = *valpos.begin();

        int add;
        auto it = posval.find(mp(p,v));
        if (it == posval.begin() || *it == *posval.rbegin()) add = v;
        else {
            auto prv = it, nxt = it;
            --prv; ++nxt;
            add = min(prv->second, nxt->second);
        }
        //cerr << p << ' ' << v << ' ' << add << endl;
        ans += add;

        valpos.erase(mp(v,p));
        posval.erase(mp(p,v));
    }
    cout << ans << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int inf = 1e9;
const ll inf_ll = 1e18;
#define all(x) (x).begin(), (x).end()
#define pb push_back

#ifdef ONLINE_JUDGE
#define debug(...)
#else
#include "../../debug.cpp"
#endif

int med(int a, int b, int c) {
    return a > b && a > c ? max(b, c) : (a < b && a < c ? min(b, c) : a);
}

const ll N = 500005;
ll a[N];
set<pair<int, ll>> m;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n; cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i], m.emplace(i, a[i]);
    m.emplace(-inf, 0); m.emplace(inf, 0);
    vector<int> o(n); iota(all(o), 0);
    sort(all(o), [&](int i, int j){return a[i] < a[j];});
    ll out = 0;
    for (auto& i : o) {
        ll l = (++m.find({i, a[i]}))->second;
        ll r = (--m.find({i, a[i]}))->second;
        if (a[i] < l && a[i] < r) {
            out += min(l, r);
            m.erase(m.find({i, a[i]}));
        }
    }
    for (auto& [i, x] : m)
        out += x;
    reverse(all(o));
    int c = 0;
    for (auto& i : o) {
        if (c == 2) break;
        if (m.find({i, a[i]}) != m.end())
            c++, out -= a[i];
    }
    cout << out << "\n";
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int inf = 1e9;
const ll inf_ll = 1e18;
#define all(x) (x).begin(), (x).end()
#define pb push_back

#ifdef ONLINE_JUDGE
#define debug(...)
#else
#include "../../debug.cpp"
#endif

const ll N = 500005;
ll a[N];
map<int, ll> m;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll n; cin >> n;
    for (int i = 0; i < n; i++)
        cin >> a[i], m[i] = a[i];
    m[-inf] = m[inf] = 0;
    vector<int> o(n); iota(all(o), 0);
    sort(all(o), [&](int i, int j){return a[i] < a[j];});
    ll out = 0;
    for (auto& i : o) {
        ll l = (++m.find(i))->second;
        ll r = (--m.find(i))->second;
        if (a[i] <= l && a[i] <= r) {
            debug(i);
            out += min(l, r);
            m.erase(m.find(i));
        }
    }
    for (auto& [i, x] : m)
        out += x;
    reverse(all(o));
    int c = 0;
    for (auto& i : o) {
        if (c == 2) break;
        if (m.find(i) != m.end())
            c++, out -= a[i];
    }
    cout << out << "\n";
}


#include<bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
const int N=5e5+50;
int a[N],n,sz=0,ans=0;
signed main(){
//	freopen(".inp","r",stdin);
//	freopen(".out","w",stdout);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[sz];
		while(sz>1&&a[sz-1]<=min(a[sz],a[sz-2])){
			ans+=min(a[sz],a[sz-2]);
			a[sz-1]=a[sz];
			sz--;
		}
		sz++;
	}
	for(int i=1;i<sz-1;i++) ans+=min(a[i-1],a[i+1]);
	cout<<ans;
}


#include<bits/stdc++.h>
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#define int long long
using namespace std;
const int N=5e5+50;
int a[N],n,sz=0,ans=0;
signed main(){
//	freopen(".inp","r",stdin);
//	freopen(".out","w",stdout);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[sz];
		while(sz>1&&a[sz-1]<=min(a[sz],a[sz-2])){
			ans+=min(a[sz],a[sz-2]);
			a[sz-1]=a[sz];
			sz--;
		}
		sz++;
	}
	for(int i=1;i<sz-1;i++) ans+=min(a[i-1],a[i+1]);
	cout<<ans;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<long long,int>, null_type, less<pair<long long,int>>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;

#define f first
#define se second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pi pair<int, int>
#define all(num) num.begin(), num.end()
#define lp(i, nodess) for (int i = 0; i < nodess; i++)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define X real()
#define Y imag()
#define angle(u) (atan2(u.Y, u.X))
#define vec(u, v) ((v) - (u))
//#define length(u) (hypot(u.Y , u.X))
#define normalize(u) (u) / length(u)
#define dotP(u, v) ((conj(u) * v).X)
#define crossP(u, v) ((conj(u) * v).Y)
#define same(p1, p2) (dotP(vec(p1, p2), vec(p1, p2)) < EPS)
#define lengthSqr(u) dotP(u, u)
#define rotate0(p, ang) ((p)*exp(point(0, ang)))
#define rotateA(p, ang, about) (rotate0(vec(about, p), ang) + about)
#define reflect0(vis, m) conj(vis / m) * m
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const double PI = acos(-1.0);
const double EPS = (1e-10);
const long long int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
typedef long long int ll;
typedef unsigned long long ull;
typedef complex<double> point;
long long fastpow(ll nodess, ll num, ll m) {
  if (!num)
    return 1;
  if (num % 2)
    return nodess * fastpow(nodess, num - 1, m)%m;
  ll p = fastpow(nodess, num / 2, m);
  p %= m;
  p *= p;
  p %= m;
  return p;
}

ll my_mod(ll num, ll mod) {
  ll reto = num % mod;
  while (reto < 0)
    reto += mod;
  return reto;
}

ll gcd(ll u, ll v) { return !u ? v : gcd(v % u, u); }
long long dist(pair<ll, ll> u, pair<ll, ll> v) {
  return
      abs(u.f - v.f)  + abs(u.se - v.se);
}
long long getDist(pair<ll, ll> &u, pair<ll, ll> &v) {
  return
     (u.f - v.f)*(u.f - v.f)  + (u.se - v.se)*(u.se-v.se);
}

/*vector<int> ap;
int np[MX+5];
void s(){
    mem(np , 1);
    np[1] = np[0] = 0;
    for(ll i = 2 ; i*i<= MX ;i++){
        if(np[i]){
            for(ll j= i*i ; j <=MX; j+=i) np[j] = 0;
        }
    }
    int idx = 1;
    for(ll i = 2 ; i<= MX ; i++){
		if(np[i]){
			np[i] = idx;
			idx++;
			ap.pb(i);
		}
	}
	//cout<<idx;
}*/
const int MX = 2e5 +9;
int main()
{
    IO;
	int tc;
	cin>>tc;
	while(tc--){
		int n,m,k;
		cin>>n>>m>>k;
		vector<int> arr(n);
		for(int i =0 ;i < n; i++) cin>>arr[i];
		int mx = m-1;
		int aa = 1;
		int toTake = m-1 - k;
		if(toTake < 0 ) toTake = 0;
		for(int j = 0 ; j <= min(k,mx); j++){
			vector<int> tst;
			int lft = k - j;
			int cend = n-1 - lft;
			int curr = INT_MAX;
			//cout<<j<<"**"<<cend<<"\n";
			for(int i = 0 ; i <= toTake; i++){
				int fromRight = toTake - i;
				int ans = max(arr[j+i], arr[cend - fromRight]);
				curr = min(curr, ans);
			}
			//cout<<j<<" "<<curr<<"\n";
			aa = max(aa, curr);
		}
		cout<<aa<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<long long,int>, null_type, less<pair<long long,int>>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;

#define f first
#define se second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pi pair<int, int>
#define all(num) num.begin(), num.end()
#define lp(i, nodess) for (int i = 0; i < nodess; i++)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define X real()
#define Y imag()
#define angle(u) (atan2(u.Y, u.X))
#define vec(u, v) ((v) - (u))
//#define length(u) (hypot(u.Y , u.X))
#define normalize(u) (u) / length(u)
#define dotP(u, v) ((conj(u) * v).X)
#define crossP(u, v) ((conj(u) * v).Y)
#define same(p1, p2) (dotP(vec(p1, p2), vec(p1, p2)) < EPS)
#define lengthSqr(u) dotP(u, u)
#define rotate0(p, ang) ((p)*exp(point(0, ang)))
#define rotateA(p, ang, about) (rotate0(vec(about, p), ang) + about)
#define reflect0(vis, m) conj(vis / m) * m
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const double PI = acos(-1.0);
const double EPS = (1e-10);
const long long int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
typedef long long int ll;
typedef unsigned long long ull;
typedef complex<double> point;
long long fastpow(ll nodess, ll num, ll m) {
  if (!num)
    return 1;
  if (num % 2)
    return nodess * fastpow(nodess, num - 1, m)%m;
  ll p = fastpow(nodess, num / 2, m);
  p %= m;
  p *= p;
  p %= m;
  return p;
}

ll my_mod(ll num, ll mod) {
  ll reto = num % mod;
  while (reto < 0)
    reto += mod;
  return reto;
}

ll gcd(ll u, ll v) { return !u ? v : gcd(v % u, u); }
long long dist(pair<ll, ll> u, pair<ll, ll> v) {
  return
      abs(u.f - v.f)  + abs(u.se - v.se);
}
long long getDist(pair<ll, ll> &u, pair<ll, ll> &v) {
  return
     (u.f - v.f)*(u.f - v.f)  + (u.se - v.se)*(u.se-v.se);
}

/*vector<int> ap;
int np[MX+5];
void s(){
    mem(np , 1);
    np[1] = np[0] = 0;
    for(ll i = 2 ; i*i<= MX ;i++){
        if(np[i]){
            for(ll j= i*i ; j <=MX; j+=i) np[j] = 0;
        }
    }
    int idx = 1;
    for(ll i = 2 ; i<= MX ; i++){
		if(np[i]){
			np[i] = idx;
			idx++;
			ap.pb(i);
		}
	}
	//cout<<idx;
}*/
const int MX = 2e5 +9;
int main()
{
    IO;
	int tc;
	cin>>tc;
	while(tc--){
		int n,m,k;
		cin>>n>>m>>k;
		vector<int> arr(n);
		for(int i =0 ;i < n; i++) cin>>arr[i];
		vector<int> tst;
		for(int i = 0 ; i < m ; i++){
			int rig = m-1 - i;
			int ans = max(arr[i], arr[n-1-rig]);
			//cout<<i<<" "<<ans<<"\n";
			tst.pb(ans);
		}
		sort(all(tst));
		if(k >= (int)tst.size()) cout<<tst.back()<<"\n";
		else{
			cout<<tst[k]<<"\n";
		}
	}
	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<long long,int>, null_type, less<pair<long long,int>>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;

#define f first
#define se second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pi pair<int, int>
#define all(num) num.begin(), num.end()
#define lp(i, nodess) for (int i = 0; i < nodess; i++)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define X real()
#define Y imag()
#define angle(u) (atan2(u.Y, u.X))
#define vec(u, v) ((v) - (u))
//#define length(u) (hypot(u.Y , u.X))
#define normalize(u) (u) / length(u)
#define dotP(u, v) ((conj(u) * v).X)
#define crossP(u, v) ((conj(u) * v).Y)
#define same(p1, p2) (dotP(vec(p1, p2), vec(p1, p2)) < EPS)
#define lengthSqr(u) dotP(u, u)
#define rotate0(p, ang) ((p)*exp(point(0, ang)))
#define rotateA(p, ang, about) (rotate0(vec(about, p), ang) + about)
#define reflect0(vis, m) conj(vis / m) * m
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const double PI = acos(-1.0);
const double EPS = (1e-10);
const long long int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
typedef long long int ll;
typedef unsigned long long ull;
typedef complex<double> point;
long long fastpow(ll nodess, ll num, ll m) {
  if (!num)
    return 1;
  if (num % 2)
    return nodess * fastpow(nodess, num - 1, m)%m;
  ll p = fastpow(nodess, num / 2, m);
  p %= m;
  p *= p;
  p %= m;
  return p;
}

ll my_mod(ll num, ll mod) {
  ll reto = num % mod;
  while (reto < 0)
    reto += mod;
  return reto;
}

ll gcd(ll u, ll v) { return !u ? v : gcd(v % u, u); }
long long dist(pair<ll, ll> u, pair<ll, ll> v) {
  return
      abs(u.f - v.f)  + abs(u.se - v.se);
}
long long getDist(pair<ll, ll> &u, pair<ll, ll> &v) {
  return
     (u.f - v.f)*(u.f - v.f)  + (u.se - v.se)*(u.se-v.se);
}

/*vector<int> ap;
int np[MX+5];
void s(){
    mem(np , 1);
    np[1] = np[0] = 0;
    for(ll i = 2 ; i*i<= MX ;i++){
        if(np[i]){
            for(ll j= i*i ; j <=MX; j+=i) np[j] = 0;
        }
    }
    int idx = 1;
    for(ll i = 2 ; i<= MX ; i++){
		if(np[i]){
			np[i] = idx;
			idx++;
			ap.pb(i);
		}
	}
	//cout<<idx;
}*/
const int MX = 2e5 +9;
int main()
{
    IO;
	int tc;
	cin>>tc;
	while(tc--){
		int n,m,k;
		cin>>n>>m>>k;
		vector<int> arr(n);
		for(int i =0 ;i < n; i++) cin>>arr[i];
		vector<pair<int,pair<int,int> > > temp;
		priority_queue<pair<int,pair<int,int> >
		, vector<pair<int,pair<int,int> >>, greater<pair<int,pair<int,int> >> > pq;
		for(int i = 0 ;i < m; i++){
			int fromRight = m-1 - i;
			int l = i, r = n-1-fromRight;
			temp.pb({max(arr[l],arr[r]), {l, r}});
			//cout<<l <<" "<<r<<" "<<max(arr[l], arr[r])<<"\n";
			pq.push({max(arr[l],arr[r]), {l, r}});
		}
		int cl = 0, cr = n-1;
		int  nn = temp.size();
		int bst = 0;
		for(int j = 0 ; j <= k; j++){
			int nl = j;
			while(pq.size()){
				auto curr = pq.top();
				if(curr.se.f < nl) pq.pop();
				else break;
			}
			int canR = k - j;
			while(pq.size()){
				auto curr = pq.top();
				if(curr.se.se > cr - canR) pq.pop();
				else break;
			}
			bst = max(bst, pq.top().f);
		}
		cout<<bst<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<long long,int>, null_type, less<pair<long long,int>>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;

#define f first
#define se second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pi pair<int, int>
#define all(num) num.begin(), num.end()
#define lp(i, nodess) for (int i = 0; i < nodess; i++)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define X real()
#define Y imag()
#define angle(u) (atan2(u.Y, u.X))
#define vec(u, v) ((v) - (u))
//#define length(u) (hypot(u.Y , u.X))
#define normalize(u) (u) / length(u)
#define dotP(u, v) ((conj(u) * v).X)
#define crossP(u, v) ((conj(u) * v).Y)
#define same(p1, p2) (dotP(vec(p1, p2), vec(p1, p2)) < EPS)
#define lengthSqr(u) dotP(u, u)
#define rotate0(p, ang) ((p)*exp(point(0, ang)))
#define rotateA(p, ang, about) (rotate0(vec(about, p), ang) + about)
#define reflect0(vis, m) conj(vis / m) * m
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const double PI = acos(-1.0);
const double EPS = (1e-10);
const long long int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
typedef long long int ll;
typedef unsigned long long ull;
typedef complex<double> point;
long long fastpow(ll nodess, ll num, ll m) {
  if (!num)
    return 1;
  if (num % 2)
    return nodess * fastpow(nodess, num - 1, m)%m;
  ll p = fastpow(nodess, num / 2, m);
  p %= m;
  p *= p;
  p %= m;
  return p;
}

ll my_mod(ll num, ll mod) {
  ll reto = num % mod;
  while (reto < 0)
    reto += mod;
  return reto;
}

ll gcd(ll u, ll v) { return !u ? v : gcd(v % u, u); }
long long dist(pair<ll, ll> u, pair<ll, ll> v) {
  return
      abs(u.f - v.f)  + abs(u.se - v.se);
}
long long getDist(pair<ll, ll> &u, pair<ll, ll> &v) {
  return
     (u.f - v.f)*(u.f - v.f)  + (u.se - v.se)*(u.se-v.se);
}

/*vector<int> ap;
int np[MX+5];
void s(){
    mem(np , 1);
    np[1] = np[0] = 0;
    for(ll i = 2 ; i*i<= MX ;i++){
        if(np[i]){
            for(ll j= i*i ; j <=MX; j+=i) np[j] = 0;
        }
    }
    int idx = 1;
    for(ll i = 2 ; i<= MX ; i++){
		if(np[i]){
			np[i] = idx;
			idx++;
			ap.pb(i);
		}
	}
	//cout<<idx;
}*/
const int MX = 2e5 +9;
int main()
{
    IO;
	int tc;
	cin>>tc;
	while(tc--){
		int n,m,k;
		cin>>n>>m>>k;
		k = min(k, m-1);
		vector<int> arr(n);
		for(int i =0 ;i < n; i++) cin>>arr[i];
		vector<pair<int,pair<int,int> > > temp;
		priority_queue<pair<int,pair<int,int> >
		, vector<pair<int,pair<int,int> >>, greater<pair<int,pair<int,int> >> > pq;
		int mxo = -1;
		for(int i = 0 ;i < m; i++){
			int fromRight = m-1 - i;
			int l = i, r = n-1-fromRight;
			temp.pb({max(arr[l],arr[r]), {l, r}});
			//cout<<l <<" "<<r<<" "<<max(arr[l], arr[r])<<"\n";
			pq.push({max(arr[l],arr[r]), {l, r}});
			mxo = max(mxo, max(arr[l], arr[r]));
		}
		int bst = 0;
		for(int j = 0 ; j <= k; j++){
			int nl = j;
			while(pq.size()){
				auto curr = pq.top();
				if(curr.se.f < nl) pq.pop();
				else break;
			}
			int canR = k - j;
			while(pq.size()){
				auto curr = pq.top();
				if(curr.se.se > n-1 - canR) pq.pop();
				else break;
			}
			if(pq.size())
			bst = max(bst, pq.top().f);
			else bst = mxo;
		}
		cout<<bst<<"\n";
	}
	return 0;
}


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<long long,int>, null_type, less<pair<long long,int>>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;

#define f first
#define se second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pi pair<int, int>
#define all(num) num.begin(), num.end()
#define lp(i, nodess) for (int i = 0; i < nodess; i++)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define X real()
#define Y imag()
#define angle(u) (atan2(u.Y, u.X))
#define vec(u, v) ((v) - (u))
//#define length(u) (hypot(u.Y , u.X))
#define normalize(u) (u) / length(u)
#define dotP(u, v) ((conj(u) * v).X)
#define crossP(u, v) ((conj(u) * v).Y)
#define same(p1, p2) (dotP(vec(p1, p2), vec(p1, p2)) < EPS)
#define lengthSqr(u) dotP(u, u)
#define rotate0(p, ang) ((p)*exp(point(0, ang)))
#define rotateA(p, ang, about) (rotate0(vec(about, p), ang) + about)
#define reflect0(vis, m) conj(vis / m) * m
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const double PI = acos(-1.0);
const double EPS = (1e-10);
const long long int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
typedef long long int ll;
typedef unsigned long long ull;
typedef complex<double> point;
long long fastpow(ll nodess, ll num, ll m) {
  if (!num)
    return 1;
  if (num % 2)
    return nodess * fastpow(nodess, num - 1, m)%m;
  ll p = fastpow(nodess, num / 2, m);
  p %= m;
  p *= p;
  p %= m;
  return p;
}

ll my_mod(ll num, ll mod) {
  ll reto = num % mod;
  while (reto < 0)
    reto += mod;
  return reto;
}

ll gcd(ll u, ll v) { return !u ? v : gcd(v % u, u); }
long long dist(pair<ll, ll> u, pair<ll, ll> v) {
  return
      abs(u.f - v.f)  + abs(u.se - v.se);
}
long long getDist(pair<ll, ll> &u, pair<ll, ll> &v) {
  return
     (u.f - v.f)*(u.f - v.f)  + (u.se - v.se)*(u.se-v.se);
}

/*vector<int> ap;
int np[MX+5];
void s(){
    mem(np , 1);
    np[1] = np[0] = 0;
    for(ll i = 2 ; i*i<= MX ;i++){
        if(np[i]){
            for(ll j= i*i ; j <=MX; j+=i) np[j] = 0;
        }
    }
    int idx = 1;
    for(ll i = 2 ; i<= MX ; i++){
		if(np[i]){
			np[i] = idx;
			idx++;
			ap.pb(i);
		}
	}
	//cout<<idx;
}*/
const int MX = 2e5 +9;
int main()
{
    IO;
	int tc;
	cin>>tc;
	while(tc--){
		int n,m,k;
		cin>>n>>m>>k;
		k = min(k, m-1);
		vector<int> arr(n);
		for(int i =0 ;i < n; i++) cin>>arr[i];
		vector<pair<int,pair<int,int> > > temp;
		priority_queue<pair<int,pair<int,int> >
		, vector<pair<int,pair<int,int> >>, greater<pair<int,pair<int,int> >> > pq;
		int mxo = -1;
		set<pair<int,int> > s;
		for(int i = 0 ;i < m; i++){
			int fromRight = m-1 - i;
			int l = i, r = n-1-fromRight;
			temp.pb({max(arr[l],arr[r]), {l, r}});
			//cout<<l <<" "<<r<<" "<<max(arr[l], arr[r])<<"\n";
			//pq.push({max(arr[l],arr[r]), {l, r}});
			s.insert({r,l});
		//	cout<<l<<" "<<r<<"\n";
			mxo = max(mxo, max(arr[l], arr[r]));
		}

		int bst = 0;
		for(int j = 0 ; j <= k; j++){
			int nl = j;
			//s.erase({n-1-m+1+j,nl});
			int canR = k - j;
			//cout<<nl<<" "<<n-1-canR<<"\n";
			while(s.size()){
				auto x = s.begin();
				//cout<<x->se<<" -- "<<x->f<<"\n";
				if(x->se >= nl && x->f <= n-1-canR) pq.push({max(arr[x->se], arr[x->f]),{x->se, x->f}});
				else break;
				//cout<<"Adding: "<<x->se<<" " <<x->f<<"\n";
				s.erase(s.begin());
			}
			while(pq.size()){
				auto curr = pq.top();
				if(curr.se.f < nl || curr.se.se > n-1 - canR) pq.pop();
				else break;
			}
			if(pq.size())
			bst = max(bst, pq.top().f);
			else bst = mxo;
		}
		cout<<bst<<"\n";
	}
	return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
using less_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
using great_set = tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update>;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
const int N = 2e3+69;
#define SF second.first
#define SS second.second
#define F first
#define ALL(x) begin(x),end(x)
#define sz(x) (ll)x.size()
const int OO = 0x3f3f3f3f;
const int mod = 1e9+7;

int t, n, m, k;
int arr[3505];
vector<int> chc;

vector<vector<int>> mem;
int solve(int ch, int l, int r, int typ)
{
    int op1, op2;
    if(ch == k)
    {
        int mn = OO;
        for(int i = 0; i < typ; i++)
        {
            mn = min(mn, max(arr[l+i], arr[r-(typ-i-1)]));
        }
        return mn;
    }
    if(mem[ch][l] != -1)
        return mem[ch][l];

    op1 = solve(ch+1, l+1, r, typ);
    op2 = solve(ch+1, l, r-1, typ);

    return mem[ch][l] = max(op1, op2);
}

int main()
{
    FIO
    cin >> t;
    while(t--)
    {
        chc.clear();
        cin >> n >> m >> k;
        mem =  vector<vector<int>>(n+5, vector<int>(n+5, -1));
        int tkn[n+3] = {0};
        for(int i = 0; i < n; i++)
        {
            cin >> arr[i];
            if(i < m)
            {
                chc.push_back(arr[i]);
                tkn[i] = 1;
            }
            if(n-i-1 < m && !tkn[i])
            {
                chc.push_back(arr[i]);
                tkn[i] = 1;
            }
        }
        sort(ALL(chc));
        if(m-k <= 1)
            cout << chc[sz(chc)-1] << "\n";
        else
            cout << solve(0, 0, n-1, m-k) << "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
using less_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
using great_set = tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update>;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
const int N = 2e3+69;
#define SF second.first
#define SS second.second
#define F first
#define ALL(x) begin(x),end(x)
#define sz(x) (ll)x.size()
const int OO = 0x3f3f3f3f;
const int mod = 1e9+7;

int t, n, m, k;
int arr[3505];
vector<int> chc;

vector<vector<int>> mem;
int solve(int ch, int l, int r, int typ)
{
    int op1, op2;
    if(ch == k)
    {
        if(typ == 3)
            return min(max(arr[l], arr[r-2]), min(max(arr[l+2], arr[r]), max(arr[l+1], arr[r-1])));
        else
            return min(max(arr[l], arr[r-1]), max(arr[r], arr[l+1]));
    }
    if(mem[ch][abs(l-r-m)] != -1)
        return mem[ch][abs(l-r-m)];

    op1 = solve(ch+1, l+1, r, typ);
    op2 = solve(ch+1, l, r-1, typ);

    return mem[ch][abs(l-r-m)] = max(op1, op2);
}

int main()
{
    FIO
    cin >> t;
    while(t--)
    {
        chc.clear();
        cin >> n >> m >> k;
        mem =  vector<vector<int>>(n+5, vector<int>(n+5, -1));
        int tkn[n+3] = {0};
        for(int i = 0; i < n; i++)
        {
            cin >> arr[i];
            if(i < m)
            {
                chc.push_back(arr[i]);
                tkn[i] = 1;
            }
            if(n-i-1 < m && !tkn[i])
            {
                chc.push_back(arr[i]);
                tkn[i] = 1;
            }
        }
        sort(ALL(chc));
        if(m-k <= 1)
            cout << chc[sz(chc)-1] << "\n";
        else if(m - k == 2 || m-k == 3)
            cout << solve(0, 0, n-1, m-k) << "\n";
        else
            cout << chc[0] << "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
using less_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
using great_set = tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update>;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
const int N = 2e3+69;
#define SF second.first
#define SS second.second
#define F first
#define ALL(x) begin(x),end(x)
#define sz(x) (ll)x.size()
const int OO = 0x3f3f3f3f;
const int mod = 1e9+7;

int t, n, m, k;
int arr[3505];
vector<int> chc;

vector<vector<int>> mem;
int solve(int ch, int l, int r, int typ)
{
    int op1, op2;
    if(ch == k)
    {
        if(typ == 3)
            return min(max(arr[l], arr[r-2]), min(max(arr[l+2], arr[r]), max(arr[l+1], arr[r-1])));
        else
            return min(max(arr[l], arr[r-1]), max(arr[r], arr[l+1]));
    }
    if(mem[ch][l] != -1)
        return mem[ch][l];

    op1 = solve(ch+1, l+1, r, typ);
    op2 = solve(ch+1, l, r-1, typ);

    return mem[ch][l] = max(op1, op2);
}

int main()
{
    FIO
    cin >> t;
    while(t--)
    {
        chc.clear();
        cin >> n >> m >> k;
        mem =  vector<vector<int>>(n+5, vector<int>(n+5, -1));
        int tkn[n+3] = {0};
        for(int i = 0; i < n; i++)
        {
            cin >> arr[i];
            if(i < m)
            {
                chc.push_back(arr[i]);
                tkn[i] = 1;
            }
            if(n-i-1 < m && !tkn[i])
            {
                chc.push_back(arr[i]);
                tkn[i] = 1;
            }
        }
        sort(ALL(chc));
        if(m-k <= 1)
            cout << chc[sz(chc)-1] << "\n";
        else if(m - k == 2 || m-k == 3)
            cout << solve(0, 0, n-1, m-k) << "\n";
        else
            cout << chc[0] << "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
using less_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
using great_set = tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update>;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
const int N = 2e3+69;
#define SF second.first
#define SS second.second
#define F first
#define ALL(x) begin(x),end(x)
#define sz(x) (ll)x.size()
const int OO = 0x3f3f3f3f;
const int mod = 1e9+7;

int t, n, m, k;
int arr[3505];
vector<int> chc;
int main()
{
    FIO
    cin >> t;
    while(t--)
    {
        chc.clear();
        cin >> n >> m >> k;
        int tkn[n+3] = {0};
        for(int i = 0; i < n; i++)
        {
            cin >> arr[i];
            if(i < m)
            {
                chc.push_back(arr[i]);
                tkn[i] = 1;
            }
            if(n-i-1 < m && !tkn[i])
            {
                chc.push_back(arr[i]);
                tkn[i] = 1;
            }
        }
//        for(int i = 0; i< sz(chc); i++)
//            cout << chc[i] << " ";
//        cout << "\n";
        sort(ALL(chc));
        if(m-k <= 1)
            cout << chc[sz(chc)-1] << "\n";
        else if(m - k == 2)
            cout << chc[sz(chc)-2] << "\n";
        else if(m-k == 3)
            cout << chc[sz(chc)-3] << "\n";
        else
            cout << chc[0] << "\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

int n,m,k;
int dp[3505][3505];
int arr[3505];

int solve(int i, int j){
    int &ret=dp[i][j];
    if(ret!=-1)return ret;
    ret=0;

    int remaining = i+(n-j);
    //cout<<"i: "<<i<<", j: "<<j<<", remaining: "<<remaining<<endl;

    if(remaining<=k)return ret=max(solve(i+1,j),solve(i,j-1));
    return ret=min(arr[i],arr[j]);

}

int main(){

    int t;
    scanf("%d",&t);

    while(t--){

        scanf("%d%d%d",&n,&m,&k);
        for(int i=0; i<n; i++)scanf("%d",&arr[i]);

        for(int i=0; i<=n; i++)
            for(int j=0; j<=n; j++)
                dp[i][j]=-1;

        printf("%d\n",solve(0,n-1));
    }
return 0;
}


#include<bits/stdc++.h>
using namespace std;

int n,m,k;
int dp[3505][3505];
int arr[3505];

int solve(int i, int j){
    int &ret=dp[i][j];
    if(ret!=-1)return ret;
    ret=0;

    int remaining = n-(i+1)-(n-j);

    if(remaining>k)return ret=max(solve(i+1,j),solve(i,j-1));
    return ret=min(arr[i],arr[j]);

}

int main(){

    int t;
    scanf("%d",&t);

    while(t--){

        scanf("%d%d%d",&n,&m,&k);
        for(int i=0; i<n; i++)scanf("%d",&arr[i]);

        for(int i=0; i<=n; i++)
            for(int j=0; j<=n; j++)
                dp[i][j]=-1;

        printf("%d\n",solve(0,n-1));
    }
return 0;
}


#include<bits/stdc++.h>
using namespace std;

int n,m,k;
int dp[3505][3505];
int arr[3505];

int solve(int i, int j){
    int &ret=dp[i][j];
    if(ret!=-1)return ret;
    ret=0;

    int remaining = i+(n-j-1);
    //cout<<"i: "<<i<<", j: "<<j<<", remaining: "<<remaining<<endl;
    if(remaining==m-1)return ret=max(arr[i],arr[j]);
    if(remaining<k)return ret=max(solve(i+1,j),solve(i,j-1));
    return ret=min(arr[i],arr[j]);

}

int main(){

    int t;
    scanf("%d",&t);

    while(t--){

        scanf("%d%d%d",&n,&m,&k);
        for(int i=0; i<n; i++)scanf("%d",&arr[i]);

        for(int i=0; i<=n; i++)
            for(int j=0; j<=n; j++)
                dp[i][j]=-1;

        printf("%d\n",solve(0,n-1));
    }
return 0;
}


#include<bits/stdc++.h>
using namespace std;

int n,m,k;
int dp[3505][3505];
int arr[3505];

int solve(int i, int j){
    int &ret=dp[i][j];
    if(ret!=-1)return ret;
    ret=0;

    int remaining = n-(i+1)-(n-j+1);
    //cout<<"i: "<<i<<", j: "<<j<<", remaining: "<<remaining<<endl;

    if(remaining>=k)return ret=max(solve(i+1,j),solve(i,j-1));
    return ret=min(arr[i],arr[j]);

}

int main(){

    int t;
    scanf("%d",&t);

    while(t--){

        scanf("%d%d%d",&n,&m,&k);
        for(int i=0; i<n; i++)scanf("%d",&arr[i]);

        for(int i=0; i<=n; i++)
            for(int j=0; j<=n; j++)
                dp[i][j]=-1;

        printf("%d\n",solve(0,n-1));
    }
return 0;
}


#include<bits/stdc++.h>
using namespace std;

int n,m,k;
int dp[3505][3505];
int arr[3505];

int solve(int i, int j){
    int &ret=dp[i][j];
    if(ret!=-1)return ret;
    ret=0;

    int remaining = i+(n-j-1);
    //cout<<"i: "<<i<<", j: "<<j<<", remaining: "<<remaining<<endl;
    if(remaining==m-1)return ret=max(arr[i],arr[j]);
    if(remaining<k)return ret=max(solve(i+1,j),solve(i,j-1));
    return ret=min(solve(i+1,j),solve(i,j-1));

}

int main(){

    int t;
    scanf("%d",&t);

    while(t--){

        scanf("%d%d%d",&n,&m,&k);
        for(int i=0; i<n; i++)scanf("%d",&arr[i]);

        for(int i=0; i<=n; i++)
            for(int j=0; j<=n; j++)
                dp[i][j]=-1;

        printf("%d\n",solve(0,n-1));
    }
return 0;
}


#include <iostream>
#include <bitset>
#include <cmath>
#include <vector>
#include <set>
using namespace std;
const int MAXN=4500;

int num[MAXN];
set<int> p;
int main(){
    ios::sync_with_stdio((false));

    int kase;cin>>kase;
    while(kase--){
        int nlen,rnk,power;
        p.clear();
        cin>>nlen>>rnk>>power;
        //power=min(power,rnk-1);

        for(int i=1;i<=nlen;i++){
            cin>>num[i];
        }
        //init
        int hasadd=1;
        for(int &i=hasadd;i<=rnk;i++){
            if(i+nlen-rnk>nlen-power)break;
            p.insert(max(num[i],num[i+nlen-rnk]));
        }
        int ans=0;
        for(int i=1;i<=power+1;i++){
            /*
            for(auto item:p){
                cout<<item<<" ";
            }
            */
            //cout<<endl;
            ans=max(ans,*p.begin());
            p.erase(max(num[i],num[i+nlen-rnk]));
            p.insert(max(num[hasadd],num[hasadd+nlen-rnk]));
            hasadd++;
        }
        cout<<ans<<endl;
    }

}


#include <iostream>
#include <set>
using namespace std;
const int MAXN=4500;

int num[MAXN];
multiset<int> p;
int main(){
    ios::sync_with_stdio((false));

    int kase;cin>>kase;
    while(kase--){
        int nlen,rnk,power;
        p.clear();
        cin>>nlen>>rnk>>power;
        power=min(power,rnk-1);

        for(int i=1;i<=nlen;i++){
            cin>>num[i];
        }
        //init
        int L=1,R=nlen-rnk+1;
        int ll=L,rr=R;
        for(int &l=ll,&r=rr;r<=nlen-power;l++,r++){
//            cout<<"get"<<l<<" "<<r<<endl;
            p.insert(max(num[l],num[r]));
        }
        int ans=0;
        for(int l=L,r=R;l<=power;l++,r++){

//            for(auto item:p){
//                cout<<item<<" ";
//            }
//            cout<<endl;
            ans=max(ans,*p.begin());
//            cout<<"erase"<<l<<" "<<r<<endl;
            p.erase(max(num[l],num[r]));
//            cout<<"get"<<ll<<" "<<rr<<endl;
            p.insert(max(num[ll],num[rr]));
            ll++,rr++;
        }
//        for(auto item:p){
//            cout<<item<<" ";
//        }
//        cout<<endl;
        ans=max(ans,*p.begin());
        cout<<ans<<endl;
    }

}


#include <iostream>
#include <bitset>
#include <cmath>
#include <vector>
#include <set>
using namespace std;
const int MAXN=4500;

int num[MAXN];
set<int> p;
int main(){
    ios::sync_with_stdio((false));

    int kase;cin>>kase;
    while(kase--){
        int nlen,rnk,power;
        p.clear();
        cin>>nlen>>rnk>>power;
        for(int i=1;i<=nlen;i++){
            cin>>num[i];
        }
        //init
        int hasadd=1;
        for(int &i=hasadd;i<=rnk;i++){
            if(i+nlen-rnk>nlen-power)break;
            p.insert(max(num[i],num[i+nlen-rnk]));
        }
        int ans=0;
        for(int i=1;i<=power+1;i++){
            /*
            for(auto item:p){
                cout<<item<<" ";
            }
            */
            //cout<<endl;
            ans=max(ans,*p.begin());
            p.erase(max(num[i],num[i+nlen-rnk]));
            p.insert(max(num[hasadd],num[hasadd+nlen-rnk]));
            hasadd++;
        }
        cout<<ans<<endl;
    }

}


#include <iostream>
#include <set>
using namespace std;
const int MAXN=4500;

int num[MAXN];
multiset<int> p;
int main(){
    ios::sync_with_stdio((false));
    p.insert(1);
    p.insert(1);

    p.erase(1);
    for(auto item:p){
        cout<<item<<" ";
    }

    int kase;cin>>kase;
    while(kase--){
        int nlen,rnk,power;
        p.clear();
        cin>>nlen>>rnk>>power;
        power=min(power,rnk-1);

        for(int i=1;i<=nlen;i++){
            cin>>num[i];
        }
        //init
        int L=1,R=nlen-rnk+1;
        int ll=L,rr=R;
        for(int &l=ll,&r=rr;r<=nlen-power;l++,r++){
            p.insert(max(num[l],num[r]));
        }
        int ans=0;
        for(int l=L,r=R;l<=power;l++,r++){
            ans=max(ans,*p.begin());
            p.erase(p.find(max(num[l],num[r])));
            p.insert(max(num[ll],num[rr]));
            ll++,rr++;
        }
        ans=max(ans,*p.begin());
        cout<<ans<<endl;
    }

}


#include <iostream>
#include <bitset>
#include <cmath>
#include <vector>
#include <set>
using namespace std;
const int MAXN=4500;

int num[MAXN];
set<int> p;
int main(){
    ios::sync_with_stdio((false));

    int kase;cin>>kase;
    while(kase--){
        int nlen,rnk,power;
        p.clear();
        cin>>nlen>>rnk>>power;
        power=min(power,rnk-1);

        for(int i=1;i<=nlen;i++){
            cin>>num[i];
        }
        //init
        int L=1,R=nlen-rnk+1;
        int ll=L,rr=R;
        for(int &l=ll,&r=rr;r<=nlen-power;l++,r++){
            p.insert(max(num[l],num[r]));
        }
        int ans=0;
        for(int l=L,r=R;l<=power;l++,r++){
            /*
            for(auto item:p){
                cout<<item<<" ";
            }
            */
            //cout<<endl;
            ans=max(ans,*p.begin());
            p.erase(max(num[l],num[r]));
            p.insert(max(num[ll],num[rr]));
            ll++,rr++;
        }
        ans=max(ans,*p.begin());
        cout<<ans<<endl;
    }

}


#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mod 1000000007
using namespace  std ;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v)
{
    ll a ;
    for(ll i=0 ; i<v.size() ; i=i+1)
    {
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
long long power(long long k , long long n , long long m)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
long long fact(long long n , long long m = mod)
{
    long long a = 1 ;
    if(n==0 || n==1)
    {
        return(1) ;
    }
    while(n>0)
    {
        a = (a%m * n%m)%m ;
        n-- ;
    }
    return(a) ;
}
ll n,m,k;
int main()
{
    ios_base::sync_with_stdio(false);//this and next two lines for cin cout TLE handling
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(6);
    ll a,b,c,d,e,x,i,j,t,y,w;
    double p,q,r,u,s ;
    string str = "",str1 = "",str2="" ;
    char ch,chr ;
    /*ll a1=0,a2=0,b1=0,b2=0 ;*/
    //cin>>str>>str1;
    cin>>t;
    while(t--)
    {
        cin>>n>>m>>k;
        vll v;
        READ(v,n);
        if(m<=k)
        {
            k = m - 1 ;
        }
        c = -1 ;
        for(i=0 ; i<=k ; i=i+1)
        {
            //hd = n - k + i - 1;
            x = 1e9;
            for(j=0 ; j<m-k; j=j+1)
            {
                a = i + j ;
                b = n - m + a ;
                x = min(x,max(v[a],v[b]));
            }
            if(x!=1e9)
            {
            	c = max(c,x);
			}
        }
        cout<<c<<"\n";
    }
}


#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mod 1000000007
using namespace  std ;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v)
{
    ll a ;
    for(ll i=0 ; i<v.size() ; i=i+1)
    {
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
long long power(long long k , long long n , long long m)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
long long fact(long long n , long long m = mod)
{
    long long a = 1 ;
    if(n==0 || n==1)
    {
        return(1) ;
    }
    while(n>0)
    {
        a = (a%m * n%m)%m ;
        n-- ;
    }
    return(a) ;
}
ll n,m,k;
vll v;
pll dp1[3503][3503];
pll dp2[3503][3503];
pll solve(ll i , ll j)
{
	pll p3(-1,-1);
    if(i+(n-1)-j==k)
    {
		pll p1(v[i],i);
		pll p2(v[j],j) ;
        return(max(p1,p2));
    }
    if(dp1[i][j]!=p3)
    {
        return(dp1[i][j]);
    }
    pll ans = max(solve(i+1,j),solve(i,j-1));
    dp1[i][j] = ans;
    return(ans);
}
pll solve1(ll i , ll j)
{
    pll p3(-1,-1);
    if(i+(n-1)-j==m)
    {
		pll p1(v[i],i);
		pll p2(v[j],j) ;
        return(min(p1,p2));
    }
    if(dp2[i][j]!=p3)
    {
        return(dp2[i][j]);
    }
    pll ans = min(solve1(i+1,j),solve1(i,j-1));
    dp2[i][j] = ans;
    return(ans);
}
int main()
{
    ios_base::sync_with_stdio(false);//this and next two lines for cin cout TLE handling
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(6);
    ll a,b,c,d,e,x,i,j,t,y,w;
    double p,q,r,u,s ;
    string str = "",str1 = "",str2="" ;
    char ch,chr ;
    /*ll a1=0,a2=0,b1=0,b2=0 ;*/
    //cin>>str>>str1;
    cin>>t;
    while(t--)
    {
        cin>>n>>m>>k;
        //vll v;
        READ(v,n);
        if(m==1)
        {
        	cout<<max(v[0],v[n-1])<<"\n";
        	continue;
		}
        if(m<=k)
        {
            k = m-1;
        }
        memset(dp1,-1,sizeof(dp1));
        memset(dp2,-1,sizeof(dp2));
        a = solve(0,n-1).second;
        b = n-1-(k-a) ;
        //m--;
        c = solve1(a,b).second;
        d = n-1-(m-c-1) ;
        cout<<max(v[c],v[d])<<"\n";
        v.clear();
    }
}


#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mod 1000000007
using namespace  std ;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v)
{
    ll a ;
    for(ll i=0 ; i<v.size() ; i=i+1)
    {
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
long long power(long long k , long long n , long long m)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
long long fact(long long n , long long m = mod)
{
    long long a = 1 ;
    if(n==0 || n==1)
    {
        return(1) ;
    }
    while(n>0)
    {
        a = (a%m * n%m)%m ;
        n-- ;
    }
    return(a) ;
}
ll n,m,k;
vll v;
pll solve(ll i , ll j)
{
	pll p3(-1,-1);
    if(i+(n-1)-j==k)
    {
		pll p1(v[i],i);
		pll p2(v[j],j) ;
        return(max(p1,p2));
    }
    pll ans = max(solve(i+1,j),solve(i,j-1));
    //dp1[i][j] = ans;
    return(ans);
}
pll solve1(ll i , ll j)
{
    pll p3(-1,-1);
    if(i+(n-1)-j==m)
    {
		pll p1(v[i],i);
		pll p2(v[j],j) ;
        return(min(p1,p2));
    }
    pll ans = min(solve1(i+1,j),solve1(i,j-1));
    //dp2[i][j] = ans;
    return(ans);
}
int main()
{
    ios_base::sync_with_stdio(false);//this and next two lines for cin cout TLE handling
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(6);
    ll a,b,c,d,e,x,i,j,t,y,w;
    double p,q,r,u,s ;
    string str = "",str1 = "",str2="" ;
    char ch,chr ;
    /*ll a1=0,a2=0,b1=0,b2=0 ;*/
    //cin>>str>>str1;
    cin>>t;
    while(t--)
    {
        cin>>n>>m>>k;
        //vll v;
        READ(v,n);
        if(m==1)
        {
        	cout<<max(v[0],v[n-1])<<"\n";
        	continue;
		}
        if(m<=k)
        {
            k = m-1;
        }
        /*memset(dp1,-1,sizeof(dp1));
        memset(dp2,-1,sizeof(dp2));*/
        a = solve(0,n-1).second;
        b = n-1-(k-a) ;
        //m--;
        c = solve1(a,b).second;
        d = n-1-(m-c-1) ;
        cout<<max(v[c],v[d])<<"\n";
        v.clear();
    }
}


#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mod 1000000007
using namespace  std ;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v)
{
    ll a ;
    for(ll i=0 ; i<v.size() ; i=i+1)
    {
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
long long power(long long k , long long n , long long m)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
long long fact(long long n , long long m = mod)
{
    long long a = 1 ;
    if(n==0 || n==1)
    {
        return(1) ;
    }
    while(n>0)
    {
        a = (a%m * n%m)%m ;
        n-- ;
    }
    return(a) ;
}
ll n,m,k;
int main()
{
    ios_base::sync_with_stdio(false);//this and next two lines for cin cout TLE handling
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(6);
    ll a,b,c,d,e,x,i,j,t,y,w;
    double p,q,r,u,s ;
    string str = "",str1 = "",str2="" ;
    char ch,chr ;
    /*ll a1=0,a2=0,b1=0,b2=0 ;*/
    //cin>>str>>str1;
    cin>>t;
    while(t--)
    {
        cin>>n>>m>>k;
        vll v;
        READ(v,n);
        if(m<=k)
        {
            k = m - 1 ;
        }
        c = -1 ;
        for(i=0 ; i<=k ; i=i+1)
        {
            //hd = n - k + i - 1;
            x = 1e18;
            for(j=0 ; j<m-k; j=j+1)
            {
                a = i + j ;
                b = n - m + a ;
                x = min(x,max(v[a],v[b]));
            }
            if(x!=1e18)
            {
            	c = max(c,x);
			}
        }
        cout<<c<<"\n";
    }
}


#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mod 1000000007
using namespace  std ;
typedef long long ll ;
typedef vector<int>vi ;
//typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
typedef vector<pll>vpll;
typedef vector<string>vstr;
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v)
{
    ll a ;
    for(ll i=0 ; i<v.size() ; i=i+1)
    {
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
long long power(long long k , long long n , long long m)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
long long fact(long long n , long long m = mod)
{
    long long a = 1 ;
    if(n==0 || n==1)
    {
        return(1) ;
    }
    while(n>0)
    {
        a = (a%m * n%m)%m ;
        n-- ;
    }
    return(a) ;
}
ll n,m,k;
int main()
{
    ios_base::sync_with_stdio(false);//this and next two lines for cin cout TLE handling
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(6);
    ll a,b,c,d,e,x,i,j,t,y,w;
    double p,q,r,u,s ;
    string str = "",str1 = "",str2="" ;
    char ch,chr ;
    /*ll a1=0,a2=0,b1=0,b2=0 ;*/
    //cin>>str>>str1;
    cin>>t;
    while(t--)
    {
        cin>>n>>m>>k;
        vll v;
        READ(v,n);
        c = 0 ;
        if(m<=k)
        {
            k = m - 1;
        }
        i = 0 ;
        j = n-1 ;
        d  = 0 ;
        while(k--)
        {
            if(v[i]>v[j])
            {
                c = v[j];
                j--;
            }
            else
            {
                c = v[i];
                i++;
            }
            d++;
            //k--;
        }
        //cout<<"gffdf"<<endl;
        while(d<m)
        {
            if(v[i]>v[j])
            {
                c = v[i];
                i++;
            }
            else
            {
                c = v[j];
                j--;
            }
            d++;
        }
        cout<<c<<"\n";
    }
}


#include<bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
using namespace std ;

ll a[2000001], pre[2000001], suf[2000001];
ll n,i,j,x,y, m, k, z, t;

int main() {

 cin >> t;
while(t--) {
  cin >> n >> m >> k;
  for (i = 1 ; i <= n; ++i) {
    cin >> a[i];
  }
  if (k >= (m - 1)) {
    i = 1; j = n;
    while(--m > 0) {
      if (a[i] < a[j]) { i++;}
      else {j--;}
    }
    cout << max(a[i], a[j]) << endl;
    continue;
  }
  ll ans = -1;
  for (i = 1; i <= n; i++) {
    j = i + n - k - 1;
    ll local_ans = 1e11;
    if (j <= n) {
      for (z = i ; z <= j; ++z) {
        ll r = z+n-(m-1)-1;
        if (r <= j) {
          local_ans = min(local_ans, max(a[z], a[z+n-(m-1)-1]));
        }
      }
    }
    if (local_ans != 1e11) ans = max(ans, local_ans);
  }

  cout << ans << endl;

}
}


#include<bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
using namespace std ;

ll a[2000001], pre[2000001], suf[2000001];
ll n,i,j,x,y, m, k, z, t;

int main() {

 cin >> t;
while(t--) {
  cin >> n >> m >> k;
  for (i = 1 ; i <= n; ++i) {
    cin >> a[i];
  }
  if (k >= (m - 1)) {
    k = m - 1;
  }
  ll ans = -1;
  for (i = 1; i <= n; i++) {
    j = i + n - k - 1;
    ll local_ans = 1e11;
    if (j <= n) {
      for (z = i ; z <= j; ++z) {
        ll r = z+n-(m-1)-1;
        if (r <= j) {
          local_ans = min(local_ans, max(a[z], a[z+n-(m-1)-1]));
        }
      }
    }
    if (local_ans != 1e11) ans = max(ans, local_ans);
  }

  cout << ans << endl;

}
}


#include<bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
using namespace std ;

ll a[2000001], pre[2000001], suf[2000001];
ll n,i,j,x,y, m, k, z, t;

int main() {

 cin >> t;
while(t--) {
  cin >> n >> m >> k;
  for (i = 1 ; i <= n; ++i) {
    cin >> a[i];
  }
  if (k >= (m - 1)) {
    i = 1; j = n;
    while(--m > 0) {
      if (a[i] < a[j]) { i++;}
      else {j--;}
    }
    cout << max(a[i], a[j]) << endl;
    continue;
  }
  ll ans = -1;

  for (i = 0; i <= k; i++) {
    ll start = i+1;
    ll end = start + (n - k - 1);
    ll local_ans = 1e11;
    //cout << "top start,end = " << start << " " << end << endl;
    if (end <= n) {
      for (z = 0; z <= (m-1); z++) {
        ll local_start = start + z;
        ll local_end = local_start + (n-m);
        //cout << "local start, end " << local_start << " " << local_end << endl;
        if (local_end <= end) {
          local_ans = min(local_ans, max(a[local_start], a[local_end]));
        }
      }
    }
    if (local_ans != 1e11) ans = max(ans, local_ans);
  }

  cout << ans << endl;

}
}


#include<bits/stdc++.h>
#define ll long long int
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
using namespace std ;

ll a[2000001], pre[2000001], suf[2000001];
ll n,i,j,x,y, m, k, z, t;

int main() {

 cin >> t;
while(t--) {
  cin >> n >> m >> k;
  for (i = 1 ; i <= n; ++i) {
    cin >> a[i];
  }
  if (k >= (m - 1)) {
    k = m-1;
  }
  ll ans = -1;

  for (i = 0; i <= k; i++) {
    ll start = i+1;
    ll end = start + (n - k - 1);
    ll local_ans = 1e11;
    //cout << "top start,end = " << start << " " << end << endl;
    if (end <= n) {
      for (z = 0; z <= (m-1); z++) {
        ll local_start = start + z;
        ll local_end = local_start + (n-m);
        //cout << "local start, end " << local_start << " " << local_end << endl;
        if (local_end <= end) {
          local_ans = min(local_ans, max(a[local_start], a[local_end]));
        }
      }
    }
    if (local_ans != 1e11) ans = max(ans, local_ans);
  }

  cout << ans << endl;

}
}


//include <GOD>

// To Saram Koli Fekre Khobo Khafan!
#include <bits/stdc++.h>
#define 	Time 	        	printf("\nTime : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define 	For(J,R,K)       	for(int J=R;J<K;++J)
#define 	Rep(I,N)         	For(I,0,N)
#define 	MP 		        	make_pair
#define 	ALL(X)       		(X).begin(),(X).end()
#define 	SF 	        		scanf
#define 	PF 		        	printf
#define 	pii         		pair<long long,long long>
#define 	piii         		pair<  long long , pii  >
#define 	pdd             		pair<double , double>
#define 	Sort(v) 	        sort(ALL(v))
#define     GSORT(x)            sort(ALL(x), greater<typeof(*((x).begin()))>())
#define 	Test 		        freopen("a.in","r",stdin)
#define 	Testout 	        freopen("a.out","w",stdout)
#define     UNIQUE(v)           Sort(v); (v).reeize(unique(ALL(v)) - (v).begin())
#define 	pb 		        	push_back
#define 	Set(a,n)        	memset(a,n,sizeof(a))
#define 	MAXN 		        100000+99
#define 	EPS 		        1e-12
#define 	inf 		        1ll<<61
#define     SF                  scanf
#define     PF                  printf
#define     F                   first
#define     S                   second
#define 	vpii         		vector<pii>
#define 	vll        		    vector<ll>
#define     booste              ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;
using namespace std;

//FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// const int sieve_size = 1000005;
// bool sieve[sieve_size+1];
//vll prime;
// void Sieve()
// {
//    prime.push_back(2);
//
//    for(int i = 3; i*i <=sieve_size ; i+=2){
//        if(!sieve[i]){
//            ll p = i*2;
//            for(int j = i*i ; j<= sieve_size ; j+=p){
//                sieve[j]=true;
//            }
//        }
//    }
//    for(int i = 3 ; i<=sieve_size ; i+=2){
//        if(!sieve[i]) prime.push_back(i);
//    }
// }
//
//

 int dx[] = {1,0,-1, 0} , dy[] = {0,1, 0, -1};  // 4 Direction
//int dx[] = {1,0,-1, 0 , 2 ,0 ,-2, 0 , 3 ,0 ,-3 ,0} ,
 //   dy[] = {0,1, 0, -1 , 0 ,2 ,0 , -2 , 0 , 3, 0 , -3};  // 4 Direction

 //int dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; // 8 Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction
inline int GA(ll n , vector<ll>&vec){
    Rep(i ,n){ll x ;cin>>x ; vec.push_back(x);}
    return 0;
}
inline int GAEG(ll m ,vector<ll>vec[]){
    Rep(i ,m){ll x  , y ;cin>>x>>y ; x-- , y-- ; vec[x].push_back(y); vec[y].push_back(x);}
    return 0;
}
const ll MD =  998244353;

bool isvalid(ll xx, ll yy , ll n , ll m ){
    return (xx>=0 && xx<n && yy>=0 && yy<m);
}

ll pw(ll x, ll y, ll dr){
    if(y==0) return 1;
    ll o = y/2;
    ll f = pw(x, o , dr)%dr;
    if(y%2){
        return (((f*f)%dr)*x)%dr;
    }
    else return (f*f)%dr;
}
vll ans;
int main(){
//    Test;
    ll t;
    cin>>t;
    while(t--){
        ll n , m ,k;
        cin>>n>>m>>k;
        ll i = 0;
        vll v;
        v.clear();
        Rep(i , n){
            ll x;cin>>x;
            v.pb(x);
        }

        while(n-m+i <n){

            ans.push_back(max(v[i] ,v[i+n-m]));
            i++;
        }
        Sort(ans);
        cout<<ans[min(k , m-1)]<<endl;
        ans.clear();
    }
    return 0;
}


//include <GOD>

// To Saram Koli Fekre Khobo Khafan!
#include <bits/stdc++.h>
#define 	Time 	        	printf("\nTime : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define 	For(J,R,K)       	for(int J=R;J<K;++J)
#define 	Rep(I,N)         	For(I,0,N)
#define 	MP 		        	make_pair
#define 	ALL(X)       		(X).begin(),(X).end()
#define 	SF 	        		scanf
#define 	PF 		        	printf
#define 	pii         		pair<long long,long long>
#define 	piii         		pair<  long long , pii  >
#define 	pdd             		pair<double , double>
#define 	Sort(v) 	        sort(ALL(v))
#define     GSORT(x)            sort(ALL(x), greater<typeof(*((x).begin()))>())
#define 	Test 		        freopen("a.in","r",stdin)
#define 	Testout 	        freopen("a.out","w",stdout)
#define     UNIQUE(v)           Sort(v); (v).reeize(unique(ALL(v)) - (v).begin())
#define 	pb 		        	push_back
#define 	Set(a,n)        	memset(a,n,sizeof(a))
#define 	MAXN 		        100000+99
#define 	EPS 		        1e-12
#define 	inf 		        1ll<<61
#define     SF                  scanf
#define     PF                  printf
#define     F                   first
#define     S                   second
#define 	vpii         		vector<pii>
#define 	vll        		    vector<ll>
#define     booste              ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;
using namespace std;

//FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// const int sieve_size = 1000005;
// bool sieve[sieve_size+1];
//vll prime;
// void Sieve()
// {
//    prime.push_back(2);
//
//    for(int i = 3; i*i <=sieve_size ; i+=2){
//        if(!sieve[i]){
//            ll p = i*2;
//            for(int j = i*i ; j<= sieve_size ; j+=p){
//                sieve[j]=true;
//            }
//        }
//    }
//    for(int i = 3 ; i<=sieve_size ; i+=2){
//        if(!sieve[i]) prime.push_back(i);
//    }
// }
//
//

 int dx[] = {1,0,-1, 0} , dy[] = {0,1, 0, -1};  // 4 Direction
//int dx[] = {1,0,-1, 0 , 2 ,0 ,-2, 0 , 3 ,0 ,-3 ,0} ,
 //   dy[] = {0,1, 0, -1 , 0 ,2 ,0 , -2 , 0 , 3, 0 , -3};  // 4 Direction

 //int dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; // 8 Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction
inline int GA(ll n , vector<ll>&vec){
    Rep(i ,n){ll x ;cin>>x ; vec.push_back(x);}
    return 0;
}
inline int GAEG(ll m ,vector<ll>vec[]){
    Rep(i ,m){ll x  , y ;cin>>x>>y ; x-- , y-- ; vec[x].push_back(y); vec[y].push_back(x);}
    return 0;
}
const ll MD =  998244353;

bool isvalid(ll xx, ll yy , ll n , ll m ){
    return (xx>=0 && xx<n && yy>=0 && yy<m);
}

ll pw(ll x, ll y, ll dr){
    if(y==0) return 1;
    ll o = y/2;
    ll f = pw(x, o , dr)%dr;
    if(y%2){
        return (((f*f)%dr)*x)%dr;
    }
    else return (f*f)%dr;
}
vll ans;
int main(){
//    Test;
    ll t;
    cin>>t;
    while(t--){
        ll n , m ,k;
        cin>>n>>m>>k;
        ll i = 0;
        vll v;
        v.clear();
        Rep(i , n){
            ll x;cin>>x;
            v.pb(x);
        }

        while(n-m+i <n){

            ans.push_back(max(v[i] ,v[i+n-m]));
            i++;
        }
        Sort(ans);
        cout<<ans[min(k ,(ll) ans.size()-1)]<<endl;
        ans.clear();
    }
    return 0;
}


//include <GOD>

// To Saram Koli Fekre Khobo Khafan!
#include <bits/stdc++.h>
#define 	Time 	        	printf("\nTime : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define 	For(J,R,K)       	for(int J=R;J<K;++J)
#define 	Rep(I,N)         	For(I,0,N)
#define 	MP 		        	make_pair
#define 	ALL(X)       		(X).begin(),(X).end()
#define 	SF 	        		scanf
#define 	PF 		        	printf
#define 	pii         		pair<long long,long long>
#define 	piii         		pair<  long long , pii  >
#define 	pdd             		pair<double , double>
#define 	Sort(v) 	        sort(ALL(v))
#define     GSORT(x)            sort(ALL(x), greater<typeof(*((x).begin()))>())
#define 	Test 		        freopen("a.in","r",stdin)
#define 	Testout 	        freopen("a.out","w",stdout)
#define     UNIQUE(v)           Sort(v); (v).reeize(unique(ALL(v)) - (v).begin())
#define 	pb 		        	push_back
#define 	Set(a,n)        	memset(a,n,sizeof(a))
#define 	MAXN 		        100000+99
#define 	EPS 		        1e-12
#define 	inf 		        1ll<<61
#define     SF                  scanf
#define     PF                  printf
#define     F                   first
#define     S                   second
#define 	vpii         		vector<pii>
#define 	vll        		    vector<ll>
#define     booste              ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;
using namespace std;

//FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// const int sieve_size = 1000005;
// bool sieve[sieve_size+1];
//vll prime;
// void Sieve()
// {
//    prime.push_back(2);
//
//    for(int i = 3; i*i <=sieve_size ; i+=2){
//        if(!sieve[i]){
//            ll p = i*2;
//            for(int j = i*i ; j<= sieve_size ; j+=p){
//                sieve[j]=true;
//            }
//        }
//    }
//    for(int i = 3 ; i<=sieve_size ; i+=2){
//        if(!sieve[i]) prime.push_back(i);
//    }
// }
//
//

 int dx[] = {1,0,-1, 0} , dy[] = {0,1, 0, -1};  // 4 Direction
//int dx[] = {1,0,-1, 0 , 2 ,0 ,-2, 0 , 3 ,0 ,-3 ,0} ,
 //   dy[] = {0,1, 0, -1 , 0 ,2 ,0 , -2 , 0 , 3, 0 , -3};  // 4 Direction

 //int dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; // 8 Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction
inline int GA(ll n , vector<ll>&vec){
    Rep(i ,n){ll x ;cin>>x ; vec.push_back(x);}
    return 0;
}
inline int GAEG(ll m ,vector<ll>vec[]){
    Rep(i ,m){ll x  , y ;cin>>x>>y ; x-- , y-- ; vec[x].push_back(y); vec[y].push_back(x);}
    return 0;
}
const ll MD =  998244353;

bool isvalid(ll xx, ll yy , ll n , ll m ){
    return (xx>=0 && xx<n && yy>=0 && yy<m);
}

ll pw(ll x, ll y, ll dr){
    if(y==0) return 1;
    ll o = y/2;
    ll f = pw(x, o , dr)%dr;
    if(y%2){
        return (((f*f)%dr)*x)%dr;
    }
    else return (f*f)%dr;
}
int main(){
//    Test;
    ll t;
    cin>>t;
    while(t--){
        ll n , m ,k;
        cin>>n>>m>>k;
        vll v;
        v.clear();
        Rep(i , n){
            ll x;cin>>x;
            v.pb(x);
        }
        k = min(k , m-1);
        ll ans =-inf;
        Rep(i , k+1){
            ll mx = inf;
            Rep(j , m-(k)){
                mx = min(mx ,max(v[i+j] , v[n-m+j+i]));
            }
            ans =max(ans, mx);
        }
        cout<<ans<<endl;
    }
    return 0;
}


//include <GOD>

// To Saram Koli Fekre Khobo Khafan!
#include <bits/stdc++.h>
#define 	Time 	        	printf("\nTime : %.3lf s.\n", clock()*1.0/CLOCKS_PER_SEC)
#define 	For(J,R,K)       	for(int J=R;J<K;++J)
#define 	Rep(I,N)         	For(I,0,N)
#define 	MP 		        	make_pair
#define 	ALL(X)       		(X).begin(),(X).end()
#define 	SF 	        		scanf
#define 	PF 		        	printf
#define 	pii         		pair<long long,long long>
#define 	piii         		pair<  long long , pii  >
#define 	pdd             		pair<double , double>
#define 	Sort(v) 	        sort(ALL(v))
#define     GSORT(x)            sort(ALL(x), greater<typeof(*((x).begin()))>())
#define 	Test 		        freopen("a.in","r",stdin)
#define 	Testout 	        freopen("a.out","w",stdout)
#define     UNIQUE(v)           Sort(v); (v).reeize(unique(ALL(v)) - (v).begin())
#define 	pb 		        	push_back
#define 	Set(a,n)        	memset(a,n,sizeof(a))
#define 	MAXN 		        100000+99
#define 	EPS 		        1e-12
#define 	inf 		        1ll<<61
#define     SF                  scanf
#define     PF                  printf
#define     F                   first
#define     S                   second
#define 	vpii         		vector<pii>
#define 	vll        		    vector<ll>
#define     booste              ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;
using namespace std;

//FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// const int sieve_size = 1000005;
// bool sieve[sieve_size+1];
//vll prime;
// void Sieve()
// {
//    prime.push_back(2);
//
//    for(int i = 3; i*i <=sieve_size ; i+=2){
//        if(!sieve[i]){
//            ll p = i*2;
//            for(int j = i*i ; j<= sieve_size ; j+=p){
//                sieve[j]=true;
//            }
//        }
//    }
//    for(int i = 3 ; i<=sieve_size ; i+=2){
//        if(!sieve[i]) prime.push_back(i);
//    }
// }
//
//

 int dx[] = {1,0,-1, 0} , dy[] = {0,1, 0, -1};  // 4 Direction
//int dx[] = {1,0,-1, 0 , 2 ,0 ,-2, 0 , 3 ,0 ,-3 ,0} ,
 //   dy[] = {0,1, 0, -1 , 0 ,2 ,0 , -2 , 0 , 3, 0 , -3};  // 4 Direction

 //int dx[] = {1,-1,0,0,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1,1,-1}; // 8 Direction
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction
inline int GA(ll n , vector<ll>&vec){
    Rep(i ,n){ll x ;cin>>x ; vec.push_back(x);}
    return 0;
}
inline int GAEG(ll m ,vector<ll>vec[]){
    Rep(i ,m){ll x  , y ;cin>>x>>y ; x-- , y-- ; vec[x].push_back(y); vec[y].push_back(x);}
    return 0;
}
const ll MD =  998244353;

bool isvalid(ll xx, ll yy , ll n , ll m ){
    return (xx>=0 && xx<n && yy>=0 && yy<m);
}

ll pw(ll x, ll y, ll dr){
    if(y==0) return 1;
    ll o = y/2;
    ll f = pw(x, o , dr)%dr;
    if(y%2){
        return (((f*f)%dr)*x)%dr;
    }
    else return (f*f)%dr;
}
vll ans;
int main(){
//    Test;
    ll t;
    cin>>t;
    while(t--){
        ll n , m ,k;
        cin>>n>>m>>k;
        ll i = 0;
        vll v;
        v.clear();
        Rep(i , n){
            ll x;cin>>x;
            v.pb(x);
        }

        while(n-m+i <n){

            ans.push_back(max(v[i] ,v[i+n-m]));
            i++;
        }
        Sort(ans);
        cout<<ans[min(k , ans.size()-1)]<<endl;
        ans.clear();
    }
    return 0;
}


#include <bits/stdc++.h>
#include<math.h>
#include<algorithm>
using namespace std;

#define ll long long

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define alll(it,A) for(it=A.begin();it!=A.end();it++)

#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define pii pair<int,int>
#define V vector<ll>
#define VB vector<bool>
#define S set<ll>
#define VV vector<V>
#define VS vector<S>
int main(){
    ll t;
    cin>>t;
    //t=1;
    while(t--){
        ll n,m,k;
        cin>>n>>m>>k;
        ll a[n];
        rep(i,0,n)cin>>a[i];
        ll i,j,temp=k;
        if(m>k){
            for(i=0,j=n-1;i<j&&temp;){
                if(a[i]<a[j])i++;
                else j--;
                temp--;
            }
            ll temp2=m-k-1;
            for(;i<j&&temp2;){
                if(a[i]>a[j])i++;
                else j--;
                temp2--;
            }
            //cout<<max(a[i],a[j])<<"\n";
        }
        else{
            temp=m-1;
            for(i=0,j=n-1;i<j&&temp;){
                if(a[i]<a[j])i++;
                else j--;
                temp--;
            }
            //ll temp2=0;
            // for(;i<j&&temp2;){
            //     if(a[i]>a[j])i++;
            //     else j--;
            //     temp2--;
            // }
            //cout<<min(a[i],a[j])<<"\n";
        }
         cout<<max(a[i],a[j])<<"\n";

    }

    return 0;
}


#include <bits/stdc++.h>
#include<math.h>
#include<algorithm>
using namespace std;

#define ll long long

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define alll(it,A) for(it=A.begin();it!=A.end();it++)

#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define pii pair<int,int>
#define V vector<ll>
#define VB vector<bool>
#define S set<ll>
#define VV vector<V>
#define VS vector<S>
int main(){
    ll t;
    cin>>t;
    //t=1;
    while(t--){
        ll n,m,k;
        cin>>n>>m>>k;
        ll a[n];
        rep(i,0,n)cin>>a[i];
        ll i,j,temp=k;
        if(m>k){
            for(i=0,j=n-1;i<j&&temp;){
                if(a[i]<=a[j])i++;
                else j--;
                temp--;
            }
            ll temp2=m-k-1;
            ll temp3=i;
            // for(;i<j&&temp2;){
            //     if(a[i]>=a[j])i++;
            //     else j--;
            //     temp2--;
            // }
            ll mini=INT_MAX;
            for(i=0;i<=temp2;i++){
                mini=min(mini,max(a[temp3+i],a[j-(temp2-i)]));
                //cout<<mini<<"in";
            }
            //cout<<max(a[i],a[j])<<"\n";
            cout<<mini<<"\n";
        }
        else{
            ll temp2=m-1;
            ll mini=INT_MAX;
            for(i=0;i<=temp2;i++){
                mini=min(mini,max(a[i],a[n-1-(temp2-i)]));
                //cout<<mini<<"in";
            }
            // for(i=0,j=n-1;i<j&&temp;){
            //     if(a[i]<=a[j])i++;
            //     else j--;
            //     temp--;
            // }
            //ll temp2=0;
            // for(;i<j&&temp2;){
            //     if(a[i]>a[j])i++;
            //     else j--;
            //     temp2--;
            // }
            //cout<<min(a[i],a[j])<<"\n";
            cout<<mini<<"\n";
        }
         //cout<<max(a[i],a[j])<<"\n";

    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main() {
    int t;
    cin>>t;
    while(t--)
    {
        int n,m,k;
        cin>>n>>m>>k;
        int ar[n];
        for(int i=0;i<n;i++)
        {
            cin>>ar[i];
        }
        int mini=min(m-1,k);
        //cout<<mini<<endl;
        vector<int>v;
        for(int i=0;i<mini+1;i++)
        {
            int start=i;
            int stop=i+(n-mini-1);
            int mi=INT_MAX;
            for(int j=0;j<(m-mini);j++)
            {
                int c1=start+j;
                int c2=stop-(m-mini-1)+j;
                int maxi=max(ar[c1],ar[c2]);
                //cout<<maxi<<" ";
                if(maxi<mi)
                    mi=maxi;
            }
            //cout<<endl;
            //cout<<mi<<endl;
            v.push_back(mi);
        }
        int maxi=INT_MIN;
        for(int i=0;i<v.size();i++)
        {
            if(v[i]>maxi)
                maxi=v[i];
        }
        cout<<maxi<<endl;
    }
}


#include <bits/stdc++.h>
#include<math.h>
#include<algorithm>
using namespace std;

#define ll long long

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define alll(it,A) for(it=A.begin();it!=A.end();it++)

#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define pii pair<int,int>
#define V vector<ll>
#define VB vector<bool>
#define S set<ll>
#define VV vector<V>
#define VS vector<S>
int main(){
    ll t;
    cin>>t;
    //t=1;
    while(t--){
        ll n,m,k;
        cin>>n>>m>>k;
        ll a[n];
        rep(i,0,n)cin>>a[i];
        ll i,j,temp=k;
        if(m>k){
            for(i=0,j=n-1;i<j&&temp;){
                if(a[i]<a[j])i++;
                else j--;
                temp--;
            }
            ll temp2=m-k-1;
            for(;i<j&&temp2;){
                if(a[i]>a[j])i++;
                else j--;
                temp2--;
            }
        }
        else{
            temp=m-1;
            for(i=0,j=n-1;i<j&&temp;){
                if(a[i]<a[j])i++;
                else j--;
                temp--;
            }
            //ll temp2=0;
            // for(;i<j&&temp2;){
            //     if(a[i]>a[j])i++;
            //     else j--;
            //     temp2--;
            // }
        }
         cout<<max(a[i],a[j])<<"\n";

    }

    return 0;
}


#include <bits/stdc++.h>
#include<math.h>
#include<algorithm>
using namespace std;

#define ll long long

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define alll(it,A) for(it=A.begin();it!=A.end();it++)

#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define pii pair<int,int>
#define V vector<ll>
#define VB vector<bool>
#define S set<ll>
#define VV vector<V>
#define VS vector<S>
int main(){
    ll t;
    cin>>t;
    //t=1;
    while(t--){
        ll n,m,k;
        cin>>n>>m>>k;
        ll a[n];
        rep(i,0,n)cin>>a[i];
        ll i,j,temp=k;
        if(m>k){
            for(i=0,j=n-1;i<j&&temp;){
                if(a[i]<a[j])i++;
                else j--;
                temp--;
            }
            ll temp2=m-k-1;
            for(;i<j&&temp2;){
                if(a[i]>a[j])i++;
                else j--;
                temp2--;
            }
            cout<<max(a[i],a[j])<<"\n";
        }
        else{
            temp=m-1;
            for(i=0,j=n-1;i<j&&temp;){
                if(a[i]<a[j])i++;
                else j--;
                temp--;
            }
            //ll temp2=0;
            // for(;i<j&&temp2;){
            //     if(a[i]>a[j])i++;
            //     else j--;
            //     temp2--;
            // }
            cout<<min(a[i],a[j])<<"\n";
        }
         //cout<<max(a[i],a[j])<<"\n";

    }

    return 0;
}


#include <bits/stdc++.h>
#include<math.h>
#include<algorithm>
using namespace std;

#define ll long long

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define alll(it,A) for(it=A.begin();it!=A.end();it++)

#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl

#define mp make_pair
#define pb push_back
#define all(A)  A.begin(),A.end()
#define ft first
#define sd second

#define pll pair<ll,ll>
#define pii pair<int,int>
#define V vector<ll>
#define VB vector<bool>
#define S set<ll>
#define VV vector<V>
#define VS vector<S>
int main(){
    ll t;
    cin>>t;
    //t=1;
    while(t--){
        ll n,m,k;
        cin>>n>>m>>k;
        ll a[n];
        rep(i,0,n)cin>>a[i];
        ll i,j,temp=k;
        if(m>k){
            for(i=0,j=n-1;i<j&&temp;){
                if(a[i]<a[j])i++;
                else j--;
                temp--;
            }
            ll temp2=m-k-1;
            for(;i<j&&temp2;){
                if(a[i]>a[j])i++;
                else j--;
                temp2--;
            }
        }
        else{
            temp=m-1;
            for(i=0,j=n-1;i<j&&temp;){
                if(a[i]<a[j])i++;
                else j--;
                temp--;
            }
            ll temp2=1;
            for(;i<j&&temp2;){
                if(a[i]>a[j])i++;
                else j--;
                temp2--;
            }
        }
         cout<<max(a[i],a[j])<<"\n";

    }

    return 0;
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define ll long long

using namespace std;

const int N = 1e6 + 7;
const int M = 22;
const int mod = 1e9 + 7;

int n,m,k;
int a[N];

void solve1()
{
    cin >> n >> m >> k;
    for( int i = 1; i <= n; i++ ){
        cin >> a[i];
    }
    if( k >= m ){
        deque < int > d;
        for( int i = 1; i <= n; i++ ){
            d.push_back(a[i]);
        }
        int x = 1;
        while( x < m ){
            x += 1;
            if( d.back() < d.front() )d.pop_back();
            else d.pop_front();
        }
        cout << max( d.front() , d.back() ) << "\n";
        return;
    }
    int ans = 0;
    for( int i = 0; i <= k; i++ ){
        int j = i + 1 , h = n - (k - i);
        int x = m - k - 1;
        int cnt = 1e9;
        for( int g = 0; g <= x; g++ ){
            cnt = min( cnt , max( a[j + g] , a[h - (x - g)] ) );
        }
        ans = max( ans , cnt );
    }
    cout << ans << "\n";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define ll long long

using namespace std;

const int N = 1e6 + 7;
const int M = 22;
const int mod = 1e9 + 7;

int n,m,k;
int a[N];

void solve1()
{
    cin >> n >> m >> k;
    for( int i = 1; i <= n; i++ ){
        cin >> a[i];
    }
    if( k >= m - 1 ){
        deque < int > d;
        for( int i = 1; i <= n; i++ ){
            d.push_back(a[i]);
        }
        int x = 1;
        while( x < m ){
            x += 1;
            if( d.back() < d.front() )d.pop_back();
            else d.pop_front();
        }
        cout << max( d.front() , d.back() ) << "\n";
        return;
    }
    int ans = 0;
    for( int i = 0; i <= k; i++ ){
        for( int f = 0; f <= min(k - i , n - m); f++ ){
            int j = i + 1 , h = n - (k - i) + f;
            int x = m - k - 1;
            int cnt = 2e9;
            for( int g = 0; g <= x; g++ ){
                cnt = min( cnt , max( a[j + g] , a[h - (x - g)] ) );
            }
            ans = max( ans , cnt );
        }
    }
    cout << ans << "\n";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define ll long long

using namespace std;

const int N = 1e6 + 7;
const int M = 22;
const int mod = 1e9 + 7;

int n,m,k;
int a[N];

void solve1()
{
    cin >> n >> m >> k;
    for( int i = 1; i <= n; i++ ){
        cin >> a[i];
    }
    k = min( k , m - 1 );
    int ans = 0;
    for( int i = 0; i <= k; i++ ){
        int j = i + 1 , h = n - (k - i);
        int x = m - k - 1;
        int cnt = 1e9;
        for( int g = 0; g <= x; g++ ){
            cnt = min( cnt , max( a[j + g] , a[h - (x - g)] ) );
        }
        ans = max( ans , cnt );
    }
    cout << ans << "\n";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define ll long long

using namespace std;

const int N = 1e6 + 7;
const int M = 22;
const int mod = 1e9 + 7;

int n,m,k;
int a[N];

void solve1()
{
    cin >> n >> m >> k;
    int ans = 2e9;
    for( int i = 1; i <= n; i++ ){
        cin >> a[i];
        ans = min( ans , a[i] );
    }
    if( k >= m - 1 ){
        deque < int > d;
        for( int i = 1; i <= n; i++ ){
            d.push_back(a[i]);
        }
        int x = 1;
        while( x < m ){
            x += 1;
            if( d.back() < d.front() )d.pop_back();
            else d.pop_front();
        }
        cout << max( d.front() , d.back() ) << "\n";
        return;
    }
    for( int i = 0; i <= k; i++ ){
        for( int f = 0; f <= min(k - i , n - m); f++ ){
            int j = i + 1 , h = n - (k - i) + f;
            int x = m - k - 1;
            int cnt = 2e9;
            for( int g = 0; g <= x; g++ ){
                cnt = min( cnt , max( a[j + g] , a[h - (x - g)] ) );
            }
            assert( cnt != 2e9 );
            ans = max( ans , cnt );
        }
    }
    cout << ans << "\n";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define ll long long

using namespace std;

const int N = 1e6 + 7;
const int M = 22;
const int mod = 1e9 + 7;

int n,m,k;
int a[N];

void solve1()
{
    cin >> n >> m >> k;
    int ans = 2e9;
    for( int i = 1; i <= n; i++ ){
        cin >> a[i];
        ans = min( ans , a[i] );
    }
    if( k >= m - 1 ){
        deque < int > d;
        for( int i = 1; i <= n; i++ ){
            d.push_back(a[i]);
        }
        int x = 1;
        while( x < m ){
            x += 1;
            if( d.back() < d.front() )d.pop_back();
            else d.pop_front();
        }
        cout << max( d.front() , d.back() ) << "\n";
        return;
    }
    for( int i = 0; i <= k; i++ ){
        for( int f = 0; f <= min(k - i , n - m); f++ ){
            int j = i + 1 , h = n - (k - i) + f;
            int x = m - k - 1;
            int cnt = 2e9;
            for( int g = 0; g <= x; g++ ){
                cnt = min( cnt , max( a[j + g] , a[h - (x - g)] ) );
                assert( h - (x - g) > 0 && j + g <= n );
            }
            ans = max( ans , cnt );
        }
    }
    cout << ans << "\n";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define ll long long

using namespace std;

const int N = 1e6 + 7;
const int M = 22;
const int mod = 1e9 + 7;

int n,m,k;
int a[N];

void solve1()
{
    cin >> n >> m >> k;
    int ans = 2e9;
    for( int i = 1; i <= n; i++ ){
        cin >> a[i];
        ans = min( ans , a[i] );
    }
    if( k >= m - 1 ){
        deque < int > d;
        for( int i = 1; i <= n; i++ ){
            d.push_back(a[i]);
        }
        int x = 1;
        while( x < m ){
            x += 1;
            if( d.back() < d.front() )d.pop_back();
            else d.pop_front();
        }
        cout << max( d.front() , d.back() ) << "\n";
        return;
    }
    for( int i = 0; i <= k; i++ ){
        for( int f = 0; f <= min(k - i , n - m); f++ ){
            int j = i + 1 , h = n - (k - i) + f;
            int x = m - k - 1;
            int cnt = 2e9;
            for( int g = 0; g <= x; g++ ){
                cnt = min( cnt , max( a[j + g] , a[h - (x - g)] ) );
            }
            ans = max( ans , cnt );
        }
    }
    cout << ans << "\n";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


#include <bits/stdc++.h>

#define fi first
#define se second
#define ll long long

using namespace std;

const int N = 1e6 + 7;
const int M = 22;
const int mod = 1e9 + 7;

int n,m,k;
int a[N];

void solve1()
{
    cin >> n >> m >> k;
    for( int i = 1; i <= n; i++ ){
        cin >> a[i];
    }
    if( k >= m ){
        deque < int > d;
        for( int i = 1; i <= n; i++ ){
            d.push_back(a[i]);
        }
        int x = 1;
        while( x < m ){
            x += 1;
            if( d.back() < d.front() )d.pop_back();
            else d.pop_front();
        }
        cout << max( d.front() , d.back() ) << "\n";
        return;
    }
    int ans = 0;
    for( int i = 0; i <= k; i++ ){
        for( int f = 0; f <= min(k - i , n - m); f++ ){
            int j = i + 1 , h = n - (k - i) + f;
            int x = m - k - 1;
            int cnt = 2e9;
            for( int g = 0; g <= x; g++ ){
                cnt = min( cnt , max( a[j + g] , a[h - (x - g)] ) );
            }
            ans = max( ans , cnt );
        }
    }
    cout << ans << "\n";
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); srand(time(0));
    //freopen( "input.txt" , "r" , stdin );
    //freopen( "output.txt" , "w" , stdout );

    int cghf = 1;cin >> cghf;
    while( cghf-- ){
        solve1();
    }
}


#include<bits/stdc++.h>
#define MOD 1000000007

#define fo(i,a,b) for(i=a;i<b;i++)
#define mp make_pair
#define pb(x) push_back(x)
typedef  long long  int ll;
typedef std::vector<ll> vi;
typedef std::vector<std::vector<ll> > vv;
#define all(a) a.begin(),a.end()
using namespace std;
ll best[3501][3501];
bool found[3501][3501]={false};
ll k;ll m;ll count;
ll ans(ll first,ll last,ll a[],ll count)
{

    if(first>last)
        exit(0);
    //cout<<first<< " "<<last<<" "<<count<<endl;
    if(count==m-1)
        return max(a[first],a[last]);
    if(count>=k)
    {
        if(found[first][last]!=0)
            return best[first][last];
        else
            {best[first][last]= min(ans(first+1,last,a,count+1),ans(first,last-1,a,count+1)),found[first][last]=true;
                   return best[first][last];}
    }
    if(count<k)
    {
        if(found[first][last]!=0)
            return best[first][last];
        else
            {best[first][last]= max(ans(first+1,last,a,count+1),ans(first,last-1,a,count+1)),found[first][last]=true;
                   return best[first][last];}
    }

}
void solve(){
   ll n,i;
   cin>>n>>m>>k;
   ll a[n+1]={0};

   fo(i,1,n+1)
    {
        cin>>a[i];
    }
    cout<<ans(1,n,a,0)<<endl;

}
int main()
{
      ios::sync_with_stdio(0);
	  cin.tie(0);cout.tie(0);
      ll t=1;
      cin>>t;

      while(t--)
      {
          memset(found,0,sizeof(found));
          solve();
      }
    return 0;
}