#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][3501];

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(best[first][last][count]!=0)
            return best[first][last][count];
        else
            {best[first][last][count] = min(ans(first+1,last,a,count+1),ans(first,last-1,a,count+1));
                   return best[first][last][count];}
    }
    if(count<k)
    {
        if(best[first][last][count]!=0)
            return best[first][last][count];
        else
            {best[first][last][count] = max(ans(first+1,last,a,count+1),ans(first,last-1,a,count+1));
                   return best[first][last][count];}
    }

}
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--)
      {
          solve();
      }
    return 0;
}


#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;

void solve(){
   ll n,i,m,k,count=0;
   cin>>n>>m>>k;
   ll a[n];
   deque<ll> q;
   fo(i,0,n)
    {
        cin>>a[i];q.pb(a[i]);
    }
    fo(count,0,m-1)
    {
        if(count<k)
        {
            if(q.front()<q.back())
                q.pop_front();
            else
                q.pop_back();
        }
        else
        {
            if(q.front()<q.back())
                q.pop_back();
            else
                q.pop_front();
        }
    }
    cout<<max(q.front(),q.back())<<endl;

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

      while(t--)
      {
          solve();
      }
    return 0;
}


#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][3501];

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(best[first][last][count]!=0)
          //  return best[first][last][count];
        //else
            //{best[first][last][count] =
             return min(ans(first+1,last,a,count+1),ans(first,last-1,a,count+1));
                   //return best[first][last][count];}
    }
    if(count<k)
    {
        //if(best[first][last][count]!=0)
         //   return best[first][last][count];
        //else
            //{best[first][last][count] =
             return max(ans(first+1,last,a,count+1),ans(first,last-1,a,count+1));
                   //return best[first][last][count];}
    }

}
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--)
      {
          solve();
      }
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define sz(v) (int)v.size()
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
const int MAXN = (int)(2e6 + 7);
using namespace std;

int t, n, m, k, a[MAXN];

void solve(){
	int currTurn = 1;
	int l = 1, r = n;
	while(currTurn <= min(k, m - 1)){
		if(a[l] < a[r]){
			++l;
		} else --r;
		currTurn += 1;
	}
	while(currTurn < m){
		if(a[l] < a[r]){
			--r;
		} else ++l;
		++currTurn;
	}
	if(a[l] < a[r]){
		cout << a[r] << endl;
	} else cout << a[l] << endl;
}

int main(){
	//freopen("test", "r", stdin);
	cin >> t;
	while(cin >> n >> m >> k){
		for(int i = 1; i <= n; i++) cin >> a[i];
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define sz(v) (int)v.size()
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
const int MAXN = (int)(2e6 + 7);
using namespace std;

int t, n, m, k, a[MAXN];

void solve(){
	k = min(k, m - 1);
	int best = INT_MIN;
	for(int x = 0; x <= k; x++){
		int ans = INT_MAX;
		for(int y = 0; y <= m - k - 1; y++){
			int curr = max(a[1 + x + y], a[1 + x + y + n - m]);
			ans = min(ans, curr);
		}
		best = max(best, ans);
	}
	cout << best << endl;
}

int main(){
	//freopen("test", "r", stdin);
	cin >> t;
	while(cin >> n >> m >> k){
		for(int i = 1; i <= n; i++) cin >> a[i];
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define sz(v) (int)v.size()
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
const int MAXN = (int)(2e6 + 7);
using namespace std;

int t, n, m, k, a[MAXN];

void solve(){
	int currTurn = 1;
	int l = 1, r = n;
	while(currTurn <= min(k, m - 1)){
		if(a[l] < a[r]){
			++l;
		} else if(a[l] > a[r]){
			--r;
		} else {
			if(l + 1 < r){
				int le = a[l + 1];
				int ri = a[r - 1];
				if(le < ri){
					++l;
				} else {
					--r;
				}
			} else {
				--r;
			}
		}
		currTurn += 1;
	}
	while(currTurn < m){
		if(a[l] < a[r]){
			--r;
		} else if(a[l] > a[r]){
			++l;
		} else {
			if(l + 1 < r){
				int le = a[l + 1];
				int ri = a[r - 1];
				if(le < ri){
					--r;
				} else {
					++l;
				}
			} else {
				--r;
			}
		}
		++currTurn;
	}
	if(a[l] < a[r]){
		cout << a[r] << endl;
	} else cout << a[l] << endl;
}

int main(){
	//freopen("test", "r", stdin);
	cin >> t;
	while(cin >> n >> m >> k){
		for(int i = 1; i <= n; i++) cin >> a[i];
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define sz(v) (int)v.size()
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
const int MAXN = (int)(2e6 + 7);
using namespace std;

int t, n, m, k, a[MAXN];

void solve(){
	int currTurn = 1;
	int l = 1, r = n;
	while(currTurn <= min(k, m - 1)){
		if(a[l] < a[r]){
			++l;
		} else if(a[l] > a[r]){
			--r;
		} else {
			if(l + 1 < r){
				int le = a[l + 1];
				int ri = a[r - 1];
				if(le < ri){
					++l;
				} else {
					--r;
				}
			} else {
				--r;
			}
		}
		currTurn += 1;
	}
	while(currTurn < m){
		if(a[l] < a[r]){
			--r;
		} else if(a[l] > a[r]){
			++l;
		} else {
			if(l + 1 < r){
				int le = a[l + 1];
				int ri = a[r - 1];
				if(le < ri){
					++l;
				} else {
					--r;
				}
			} else {
				--r;
			}
		}
		++currTurn;
	}
	if(a[l] < a[r]){
		cout << a[r] << endl;
	} else cout << a[l] << endl;
}

int main(){
	//freopen("test", "r", stdin);
	cin >> t;
	while(cin >> n >> m >> k){
		for(int i = 1; i <= n; i++) cin >> a[i];
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define sz(v) (int)v.size()
#define pii pair<int, int>
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
const int MAXN = (int)(2e6 + 7);
using namespace std;

int t, n, m, k, a[MAXN], b[MAXN], T[4 * MAXN];

void build(int a[], int l, int r, int node){
	if(l == r){
		T[node] = a[l];
		return;
	}
	int mid = (l + r) / 2;
	build(a, l, mid, 2 * node);
	build(a, mid + 1, r, 2 * node + 1);
	T[node] = min(T[2 * node], T[2 * node + 1]);
}

int getMin(int x, int y, int l, int r, int node){
	if(x <= l && r <= y){
		return T[node];
	}
	if(y < l || x > r) return INT_MAX;
	int mid = (l + r) / 2;
	return min(getMin(x, y, l, mid, 2 * node), getMin(x, y, mid + 1, r, 2 * node + 1));
}

void solve(){
	k = min(k, m - 1);
	// i in [0, m - 1]
	for(int i = 0; i <= m - 1; i++){
		b[i] = max(a[i + 1], a[i + 1 + n - m]);
	}
	// build IT
	build(b, 0, m - 1, 1);
	// get ANS
	int best = INT_MIN;
	for(int x = 0; x <= k; x++){
		best = max(best, getMin(x, x + m - k - 1, 0, m - 1, 1));
	}
	cout << best << endl;
}

int main(){
	//freopen("test", "r", stdin);
	cin >> t;
	while(cin >> n >> m >> k){
		for(int i = 1; i <= n; i++) cin >> a[i];
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
#define int long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second
#define sz(n) (int)(n.size())
#define min3(a,b,c) fmin(a,fmin(b,c))
#define max3(a,b,c) fmax(a,fmax(b,c))
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define hell 1000000007
#define dec(a) fixed<<setprecision(a)<<
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

int solve()
{
  int n,m,k;
  cin>>n>>m>>k;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  int st,en;
  if(m>k)
  {
    int fans=0;
    for(int i=0;i<k+1;i++)
    {
      st=i;
      en=n-1-k+i;
      int ans=hell;
      for(int j=0;j<m-k;j++)
      {
        int temp=fmax(a[st+j],a[en-m+k+1+j]);
        if(temp<ans)
          ans=temp;
      }
      if(fans<ans)
        fans=ans;
    }
    cout<<fans<<endl;
  }
  else
  {
    int fans=0;
    for(int i=0;i<m;i++)
    {
      st=i;
      en=n-m+i;
      fans=max3(fans,a[st],a[en]);
    }
    cout<<fans<<endl;
  }
}

signed main()
{
  IOS;
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  int tc=1;
  cin>>tc;
  while(tc--)
  {
    solve();
  }
}


#include <bits/stdc++.h>
#define int long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second
#define sz(n) (int)(n.size())
#define min3(a,b,c) fmin(a,fmin(b,c))
#define max3(a,b,c) fmax(a,fmax(b,c))
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define hell 1000000007
#define dec(a) fixed<<setprecision(a)<<
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

int solve()
{
  int n,m,k;
  cin>>n>>m>>k;
  int a[n];
  int st=0;
  int en=n-1;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  if(m>k)
  {
    for(int i=0;i<k;i++)
    {
      if(a[st]>a[en])
        en--;
      else
        st++;
    }
    m=m-k;
    int ans=hell;
    for(int i=0;i<m;i++)
    {
      int temp=fmax(a[st+i],a[en-m+1+i]);
      if(temp<ans)
        ans=temp;
    }
    cout<<ans<<endl;
  }
  else
  {
    for(int i=0;i<m-1;i++)
    {
      if(a[st]>a[en])
        en--;
      else
        st++;
    }
    cout<<(int)(fmax(a[st],a[en]))<<endl;
  }
}

signed main()
{
  IOS;
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  int tc=1;
  cin>>tc;
  while(tc--)
  {
    solve();
  }
}


#include <bits/stdc++.h>
#define int long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second
#define sz(n) (int)(n.size())
#define min3(a,b,c) fmin(a,fmin(b,c))
#define max3(a,b,c) fmax(a,fmax(b,c))
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define hell 1000000007
#define dec(a) fixed<<setprecision(a)<<
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

int solve()
{
  int n,m,k;
  cin>>n>>m>>k;
  int a[n];
  int st=0;
  int en=n-1;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  if(m>k)
  {
    for(int i=0;i<k;i++)
    {
      if(a[st]>a[en])
        en--;
      else
        st++;
    }
    m=m-k;
    int ans=hell;
    for(int i=0;i<m;i++)
    {
      int temp=fmax(a[st+i],a[en-m+1+i]);
      if(temp<ans)
        ans=temp;
    }
    cout<<ans<<endl;
  }
  else
  {
    int ans;
    for(int i=0;i<m-1;i++)
    {
      if(a[st]>a[en])
        en--;
      else
        st++;
    }
    ans=((a[st]>a[en])?a[st]:a[en]);
    cout<<ans<<endl;
  }
  return 0;
}

signed main()
{
  IOS;
  int tc=1;
  cin>>tc;
  while(tc--)
  {
    solve();
  }
}


#include <bits/stdc++.h>
#define int long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second
#define sz(n) (int)(n.size())
#define min3(a,b,c) fmin(a,fmin(b,c))
#define max3(a,b,c) fmax(a,fmax(b,c))
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define hell 1000000007
#define dec(a) fixed<<setprecision(a)<<
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

int solve()
{
  int n,m,k;
  cin>>n>>m>>k;
  int a[n];
  int st=0;
  int en=n-1;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  if(m>k)
  {
    for(int i=0;i<k;i++)
    {
      if(a[st]>a[en])
        en--;
      else
        st++;
    }
    m=m-k;
    int ans=hell;
    for(int i=0;i<m;i++)
    {
      int temp=fmax(a[st+i],a[en-m+1+i]);
      if(temp<ans)
        ans=temp;
    }
    cout<<ans<<endl;
  }
  else
  {
    int ans;
    for(int i=0;i<m-1;i++)
    {
      if(a[st]>a[en])
        en--;
      else
        st++;
    }
    ans=((a[st]>a[en])?a[st]:a[en]);
    cout<<ans<<endl;
  }
}

signed main()
{
  IOS;
  int tc=1;
  cin>>tc;
  while(tc--)
  {
    solve();
  }
}


#include <bits/stdc++.h>
#define int long long int
#define all(v) v.begin(),v.end()
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second
#define sz(n) (int)(n.size())
#define min3(a,b,c) fmin(a,fmin(b,c))
#define max3(a,b,c) fmax(a,fmax(b,c))
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define hell 1000000007
#define dec(a) fixed<<setprecision(a)<<
#define tr(container, it) for(typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

int solve()
{
  int n,m,k;
  cin>>n>>m>>k;
  int a[n];
  int st=0;
  int en=n-1;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
  }
  if(m>k)
  {
    for(int i=0;i<k;i++)
    {
      if(a[st]>a[en])
        en--;
      else
        st++;
    }
    m=m-k;
    int ans=hell;
    for(int i=0;i<m;i++)
    {
      int temp=fmax(a[st+i],a[en-m+1+i]);
      if(temp<ans)
        ans=temp;
    }
    cout<<ans<<endl;
  }
  else
  {
    for(int i=0;i<m-1;i++)
    {
      if(a[st]>a[en])
        en--;
      else
        st++;
    }
    cout<<fmax(a[st],a[en])<<endl;
  }
}

signed main()
{
  IOS;
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  int tc=1;
  cin>>tc;
  while(tc--)
  {
    solve();
  }
}


//By UditDesai
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define trav(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define nl cout<<'\n'
#define sp <<' '<<
#define sz(a) (int)(a.size())
#define check(x) cout << #x << " : " << (x) << endl
#define show(a) for(auto i:a) cout<<i<<" ";cout<<endl//By UditDesai
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int N=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

int main()
{
	fastio;
	int t;
	cin>>t;
	while(t--)
	{
		ll n,m,k;
		cin>>n>>m>>k;
		ll a[n],i,j,tmp;
		ll ans = -1,tans;
		forn(i,n) cin>>a[i];
		if(m<=k)
		{
			ll l = 0,r = n-1;
			for(i=0;i<m-1;i++)
			{
				if(a[l]<a[r])
					l++;
				else
					r--;
			}
			cout<<max(a[l],a[r]);nl;
		}
		else
		{
			for(i=0;i<=k;i++)
			{
				ll tans = 1e18;
				for(j=0;j<=m-k-1;j++)
				{
					tans = min(tans,max(a[i+j],a[n-(m-j-i-1)-1]));
				}
				ans = max(ans,tans);
			}
			cout<<ans;
			nl;
		}

	}

}


//By UditDesai
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define trav(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define nl cout<<'\n'
#define sp <<' '<<
#define sz(a) (int)(a.size())
#define check(x) cout << #x << " : " << (x) << endl
#define show(a) for(auto i:a) cout<<i<<" ";cout<<endl//By UditDesai
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int N=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

int main()
{
	fastio;
	int t;
	cin>>t;
	while(t--)
	{
		ll n,m,k;
		cin>>n>>m>>k;
		ll a[n+1],i,j,tmp;
		ll ans = -1,tans;
		forsn(i,1,n+1) cin>>a[i];
		if(m<=k-1)
		{
			ll l = 1,r = n;
			for(i=0;i<m-1;i++)
			{
				if(a[l]<a[r])
					l++;
				else
					r--;
			}
			cout<<max(a[l],a[r]);nl;
		}
		else
		{
			for(i=0;i<=k;i++)
			{
				ll tans = 1e18;
				for(j=0;j<=m-k-1;j++)
				{
					tans = min(tans,max(a[i+j+1],a[n-(m-j-i-1)]));
				}
				ans = max(ans,tans);
			}
			cout<<ans;
			nl;
		}

	}

}


//By UditDesai
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define trav(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define nl cout<<'\n'
#define sp <<' '<<
#define sz(a) (int)(a.size())
#define check(x) cout << #x << " : " << (x) << endl
#define show(a) for(auto i:a) cout<<i<<" ";cout<<endl//By UditDesai
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int N=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

int main()
{
	fastio;
	int t;
	cin>>t;
	while(t--)
	{
		ll n,m,k;
		cin>>n>>m>>k;
		ll a[n+1],i,j,tmp;
		ll ans = -1,tans;
		forsn(i,1,n+1) cin>>a[i];
		if(m-1 <= k)
		{
			ll l = 1,r = n;
			for(i=0;i<m-1;i++)
			{
				if(a[l]<a[r])
					l++;
				else
					r--;
			}
			cout<<max(a[l],a[r]);nl;
		}
		else
		{
			for(i=0;i<=k;i++)
			{
				ll tans = 1e18;
				for(j=0;j<=m-k-1;j++)
				{
					tans = min(tans,max(a[i+j+1],a[n-(m-j-i-1)]));
				}
				ans = max(ans,tans);
			}
			cout<<ans;
			nl;
		}

	}

}


//By UditDesai
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define trav(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define nl cout<<'\n'
#define sp <<' '<<
#define sz(a) (int)(a.size())
#define check(x) cout << #x << " : " << (x) << endl
#define show(a) for(auto i:a) cout<<i<<" ";cout<<endl//By UditDesai
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int N=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

int main()
{
	fastio;
	int t;
	cin>>t;
	while(t--)
	{
		int i,j,n,m,k,l,r;
		cin>>n>>m>>k;
		int a[n];
		forn(i,n) cin>>a[i];
		l = 0;
		r = n-1;
		if(m>k)
		{
			for(i=0;i<k;i++)
			{
				if(a[l]<a[r])
					l++;
				else
					r--;
			}
			for(i=0;i<m-k-1;i++)
			{
				if(a[l]>a[r])
					l++;
				else
					r--;
			}
			cout<<max(a[l],a[r]);nl;

		}
		else
		{
			for(i=0;i<m-1;i++)
			{
				if(a[l]<a[r])
					l++;
				else
					r--;
			}
			cout<<max(a[l],a[r]);nl;
		}

	}
	return 0;
}


//By UditDesai
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define trav(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define nl cout<<'\n'
#define sp <<' '<<
#define sz(a) (int)(a.size())
#define check(x) cout << #x << " : " << (x) << endl
#define show(a) for(auto i:a) cout<<i<<" ";cout<<endl//By UditDesai
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int N=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

int main()
{
	fastio;
	int t;
	cin>>t;
	while(t--)
	{
		ll n,m,k;
		cin>>n>>m>>k;
		ll a[n+1],i,j,tmp;
		ll ans = -1,tans;
		forsn(i,1,n+1) cin>>a[i];
		k = min(m-1,k);
		for(i=0;i<=k;i++)
		{
			ll tans = 1e18;
			for(j=0;j<=m-k-1;j++)
			{
				tans = min(tans,max(a[i+j+1],a[n-(m-j-i-1)]));
			}
			ans = max(ans,tans);
		}
		cout<<ans;
		nl;

	}

}


//By UditDesai
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define trav(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define nl cout<<'\n'
#define sp <<' '<<
#define sz(a) (int)(a.size())
#define check(x) cout << #x << " : " << (x) << endl
#define show(a) for(auto i:a) cout<<i<<" ";cout<<endl//By UditDesai
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int N=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

int main()
{
	fastio;
	int t;
	cin>>t;
	while(t--)
	{
		int n,m,k;
		cin>>n>>m>>k;
		int a[n],i,j,tmp;
		int ans = -1,tans;
		forn(i,n) cin>>a[i];
		if(m<=k)
		{
			int l = 0,r = n-1;
			for(i=0;i<m-1;i++)
			{
				if(a[l]<a[r])
					l++;
				else
					r--;
			}
			cout<<max(a[l],a[r]);nl;
		}
		else
		{
			for(i=0;i<=k;i++)
			{
				int tans = 1e9+5;
				for(j=0;j<=m-k-1;j++)
				{
					tans = min(tans,max(a[i+j],a[n-(m-j-i-1)-1]));
				}
				ans = max(ans,tans);
			}
			cout<<ans;
			nl;
		}

	}

}


#include <bits/stdc++.h>
#include <iomanip>
#include <typeinfo>
#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll int,ll int>
#define pii             pair<ll int,ll int>
#define vi              vector<ll int>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll int)x.size()
#define hell            1000000007
#define PI              3.14159265358979323844
#define rep(i,a,b)      for (long long int i=a;i<b;i++)
#define repr(i,a,b)     for (long long int i=a-1;i>=b;i--)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define bs              binary_search
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n,m,k,temp,ans=0;
    cin>>n>>m>>k;
    ll arr[n];
    rep(i,0,n){
        cin>>arr[i];
    }
    k=min(k,m-1);
    rep(i,0,k+1){
        temp=1e9;
        rep(j,0,m-k){
            temp=min(temp,max(arr[i+j],arr[i+j+n-m]));
        }
        ans=max(ans,temp);
        //cout<<ans<<endl;
    }
    cout<<ans<<endl;
}

signed main() {
    ios
    ll test=1;
    cin>>test;
    while (test--) solve();
    return 0;
}


#include <bits/stdc++.h>
#include <iomanip>
#include <typeinfo>
#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll int,ll int>
#define pii             pair<ll int,ll int>
#define vi              vector<ll int>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll int)x.size()
#define hell            1000000007
#define PI              3.14159265358979323844
#define rep(i,a,b)      for (long long int i=a;i<b;i++)
#define repr(i,a,b)     for (long long int i=a-1;i>=b;i--)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define bs              binary_search
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n,m,k,temp1,temp2;
    cin>>n>>m>>k;
    ll arr[n];
    rep(i,0,n){
        cin>>arr[i];
    }
    ll ans=0;
    ll start=0,end=n-1;
    if (m-1<=k){
        rep(i,0,m){
            ans=max(ans,arr[i]);
        }
        repr(i,n,n-m){
            ans=max(ans,arr[i]);
        }
        cout<<ans<<endl;
        return;
    }
    rep(i,0,k){
        if (arr[start]>arr[end]){
            end--;
        }
        else if (arr[start]<arr[end]){
            start++;
        }
        else {
            temp1=start,temp2=end;
            while (temp1==temp2 && temp1<temp2){
                temp1++;
                temp2--;
            }
            if (arr[temp1]>arr[temp2]){
                start++;
            }
            else{
                end--;
            }
        }
    }
    ans=1e9;
    rep(i,start,end-n+m){
        ans=min(ans,min(arr[i],arr[i+n-m+1]));
    }
    cout<<ans<<endl;

}

signed main() {
    ios
    ll test=1;
    cin>>test;
    while (test--) solve();
    return 0;
}


#include <bits/stdc++.h>
#include <iomanip>
#include <typeinfo>
#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll int,ll int>
#define pii             pair<ll int,ll int>
#define vi              vector<ll int>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll int)x.size()
#define hell            1000000007
#define PI              3.14159265358979323844
#define rep(i,a,b)      for (long long int i=a;i<b;i++)
#define repr(i,a,b)     for (long long int i=a-1;i>=b;i--)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define bs              binary_search
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n,m,k,temp1,temp2;
    cin>>n>>m>>k;
    ll arr[n];
    rep(i,0,n){
        cin>>arr[i];
    }
    ll ans=0;
    ll start=0,end=n-1;
    if (m-1<=k){
        rep(i,0,m){
            ans=max(ans,arr[i]);
        }
        repr(i,n,n-m){
            ans=max(ans,arr[i]);
        }
        cout<<ans<<endl;
        return;
    }
    rep(i,0,k){
        if (arr[start]>arr[end]){
            end--;
        }
        else if (arr[start]<arr[end]){
            start++;
        }
        else {
            temp1=start,temp2=end;
            while (temp1==temp2 && temp1<temp2){
                temp1++;
                temp2--;
            }
            if (arr[temp1]>arr[temp2]){
                start++;
            }
            else{
                end--;
            }
        }
    }
    ans=1e9;
    rep(i,0,n-m+1){
        ans=min(ans,max(arr[start],arr[start+m-k-1]));
    }
    cout<<ans<<endl;

}

signed main() {
    ios
    ll test=1;
    cin>>test;
    while (test--) solve();
    return 0;
}


#include <bits/stdc++.h>
#include <iomanip>
#include <typeinfo>
#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll int,ll int>
#define pii             pair<ll int,ll int>
#define vi              vector<ll int>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll int)x.size()
#define hell            1000000007
#define PI              3.14159265358979323844
#define rep(i,a,b)      for (long long int i=a;i<b;i++)
#define repr(i,a,b)     for (long long int i=a-1;i>=b;i--)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define bs              binary_search
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n,m,k,temp1,temp2;
    cin>>n>>m>>k;
    ll arr[n];
    rep(i,0,n){
        cin>>arr[i];
    }
    ll start=0,end=n-1;
    rep(i,0,min(k,m-1)){
        if (arr[start]>arr[end]){
            end--;
        }
        else if (arr[start]<arr[end]){
            start++;
        }
        else {
            temp1=start,temp2=end;
            while (temp1==temp2 && temp1<temp2){
                temp1++;
                temp2--;
            }
            if (arr[temp1]>arr[temp2]){
                start++;
            }
            else{
                end--;
            }
        }
    }
    rep(i,k+1,m){
        if (arr[start]>arr[end]){
            start++;
        }
        else if (arr[start]<arr[end]){
            end--;
        }
        else{
            temp1=start,temp2=end;
            while (temp1==temp2 && temp1<temp2){
                temp1++;
                temp2--;
            }
            if (arr[temp1]>arr[temp2]){
                end--;
            }
            else{
                start++;
            }
        }
    }
    cout<<max(arr[start],arr[end])<<endl;
}

signed main() {
    ios
    ll test=1;
    cin>>test;
    while (test--) solve();
    return 0;
}


#include <bits/stdc++.h>
#include <iomanip>
#include <typeinfo>
#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll int,ll int>
#define pii             pair<ll int,ll int>
#define vi              vector<ll int>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll int)x.size()
#define hell            1000000007
#define PI              3.14159265358979323844
#define rep(i,a,b)      for (long long int i=a;i<b;i++)
#define repr(i,a,b)     for (long long int i=a-1;i>=b;i--)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define bs              binary_search
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n,m,k,temp1,temp2;
    cin>>n>>m>>k;
    ll arr[n];
    rep(i,0,n){
        cin>>arr[i];
    }
    ll ans=0;
    ll start=0,end=n-1;
    if (m-1<=k){
        rep(i,0,m){
            ans=max(ans,arr[i]);
        }
        repr(i,n,n-m){
            ans=max(ans,arr[i]);
        }
        cout<<ans<<endl;
        return;
    }
    rep(i,0,k){
        if (arr[start]>arr[end]){
            end--;
        }
        else if (arr[start]<arr[end]){
            start++;
        }
        else {
            temp1=start,temp2=end;
            while (temp1==temp2 && temp1<temp2){
                temp1++;
                temp2--;
            }
            if (arr[temp1]>arr[temp2]){
                start++;
            }
            else{
                end--;
            }
        }
    }
    ll ans=1e9;
    rep(i,0,n-m+1){
        ans=min(ans,max(arr[start],arr[start+m-k-1]));
    }
    cout<<ans<<endl;

}

signed main() {
    ios
    ll test=1;
    cin>>test;
    while (test--) solve();
    return 0;
}


#include <bits/stdc++.h>
#include <iomanip>
#include <typeinfo>
#define ll              long long
#define pb              push_back
#define ppb             pop_back
#define endl            '\n'
#define mii             map<ll int,ll int>
#define pii             pair<ll int,ll int>
#define vi              vector<ll int>
#define vs              vector<string>
#define all(a)          (a).begin(),(a).end()
#define F               first
#define S               second
#define sz(x)           (ll int)x.size()
#define hell            1000000007
#define PI              3.14159265358979323844
#define rep(i,a,b)      for (long long int i=a;i<b;i++)
#define repr(i,a,b)     for (long long int i=a-1;i>=b;i--)
#define lbnd            lower_bound
#define ubnd            upper_bound
#define bs              binary_search
#define mp              make_pair
#define ios             ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

/*----------------------Graph Moves----------------*/
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

//primes for hashing 937,991,1013,1409,1741

void solve() {
    ll n,m,k,temp1,temp2;
    cin>>n>>m>>k;
    ll arr[n];
    rep(i,0,n){
        cin>>arr[i];
    }
    ll ans=0;
    ll start=0,end=n-1;
    if (m-1<=k){
        rep(i,0,m){
            ans=max(ans,arr[i]);
        }
        repr(i,n,n-m){
            ans=max(ans,arr[i]);
        }
        cout<<ans<<endl;
        return;
    }
    rep(i,0,min(k,m-1)){
        if (arr[start]>arr[end]){
            end--;
        }
        else if (arr[start]<arr[end]){
            start++;
        }
        else {
            temp1=start,temp2=end;
            while (temp1==temp2 && temp1<temp2){
                temp1++;
                temp2--;
            }
            if (arr[temp1]>arr[temp2]){
                start++;
            }
            else{
                end--;
            }
        }
    }
    rep(i,k+1,m){
        if (arr[start]>arr[end]){
            start++;
        }
        else if (arr[start]<arr[end]){
            end--;
        }
        else{
            temp1=start,temp2=end;
            while (temp1==temp2 && temp1<temp2){
                temp1++;
                temp2--;
            }
            if (arr[temp1]>arr[temp2]){
                end--;
            }
            else{
                start++;
            }
        }
    }
    cout<<max(arr[start],arr[end])<<endl;
}

signed main() {
    ios
    ll test=1;
    cin>>test;
    while (test--) solve();
    return 0;
}


#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<functional>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<set>
#include<map>

#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 2e9
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
const double PI = acos(-1);

using namespace std;
int A[3501];
bool dp[3501][3501];
int main(void) {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	//	freopen("input.txt", "r", stdin);

	int T; cin >> T;
	while (T--) {
		int n, m, k; cin >> n >> m >> k;
		for (int i = 1; i <= n; i++) cin >> A[i];
		int ans = 0;
		memset(dp, 0, sizeof(dp));
		if (k >= m) k = m - 1;
		for (int i = 0; i <= k; i++) {
			int temp = MAX;
			for (int j = 0; j <= m - k - 1; j++) {
				temp = min(temp, max(A[i + j + 1], A[n - m + 1 + i + j]));
			}
			ans = max(temp, ans);
		}
		cout << ans << '\n';
	}
}


#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<functional>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<set>
#include<map>

#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 2e9
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
const double PI = acos(-1);

using namespace std;
int A[3501];
int main(void) {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	//	freopen("input.txt", "r", stdin);

	int T; cin >> T;
	while (T--) {
		int n, m, k; cin >> n >> m >> k;
		for (int i = 1; i <= n; i++) cin >> A[i];
		int s = 1;
		int e = n;
		if (k >= m) k = m - 1;
		m -= k;
		while (k--) {
			if (A[s] < A[e]) s++;
			else if (A[s] > A[e]) e--;
			else {
				if (A[s + 1] < A[e - 1]) s++;
				else e--;
			}
		}
	//	cout << s << ' ' << e << '\n';

		int mi = MAX;
		if (m == 1) mi = min(A[s], A[e]);
		for (int i = s; i < s + m-1; i++) {
			mi = min(mi, A[i]);
		}
		for (int i = e; i > e - m+1; i--) {
			mi = min(mi, A[i]);
		}
		cout << mi << '\n';
	}

}


#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<functional>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<set>
#include<map>

#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 2e9
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
const double PI = acos(-1);

using namespace std;
int A[3501];
int main(void) {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	//	freopen("input.txt", "r", stdin);

	int T; cin >> T;
	while (T--) {
		int n, m, k; cin >> n >> m >> k;
		for (int i = 1; i <= n; i++) cin >> A[i];
		int ans = 0;
		if (k >= m) k = m - 1;
		for (int i = 0; i <= k; i++) {
			int temp = MAX;
			for (int j = 0; j <= m - k - 1; j++) {
				temp = min(temp, max(A[i + j + 1], A[n - m + 1 + i + j]));
			}
			ans = max(temp, ans);
		}
		cout << ans << '\n';
	}
}


#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<functional>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<set>
#include<map>

#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 2e9
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
const double PI = acos(-1);

using namespace std;
int A[3501];
int main(void) {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	//	freopen("input.txt", "r", stdin);

	int T; cin >> T;
	while (T--) {
		int n, m, k; cin >> n >> m >> k;
		for (int i = 1; i <= n; i++) cin >> A[i];
		int s = 1;
		int e = n;
		if (k >= m) k = m - 1;
		m -= k;
		while (k--) {
			if (A[s] < A[e]) s++;
			else if (A[s] > A[e]) e--;
			else {
				if (A[s + 1] < A[e - 1]) s++;
				else e--;
			}
		}
	//	cout << s << ' ' << e << '\n';

		int mi = MAX;
		if (m == 1) mi = max(A[s], A[e]);
		for (int i = s; i < s + m-1; i++) {
			mi = min(mi, A[i]);
		}
		for (int i = e; i > e - m+1; i--) {
			mi = min(mi, A[i]);
		}
		cout << mi << '\n';
	}

}


#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<functional>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<set>
#include<map>

#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 2e9
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
const double PI = acos(-1);

using namespace std;
int A[3501];
int main(void) {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	//	freopen("input.txt", "r", stdin);

	int T; cin >> T;
	while (T--) {
		int n, m, k; cin >> n >> m >> k;
		for (int i = 1; i <= n; i++) cin >> A[i];
		int ans = 0;
		if (k >= m) k = m - 1;
		for (int i = 0; i <= k; i++) {
			for (int s = 0; s <= k - i; s++) {
				int temp = MAX;
				for (int j = i; j < m - s; j++) {
					temp = min(temp, max(A[j + 1], A[n - m + j + 1]));
				}
				ans = max(ans, temp);
			}
		}
		cout << ans << '\n';

	}

}


#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<cmath>
#include<functional>
#include<string>
#include<vector>
#include<cstring>
#include<utility>
#include<set>
#include<map>

#define ll long long
#define ull unsigned long long
#define MOD 1000000007
#define MAX 2e9
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()
const double PI = acos(-1);

using namespace std;
int A[3501];
int main(void) {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	//	freopen("input.txt", "r", stdin);

	int T; cin >> T;
	while (T--) {
		int n, m, k; cin >> n >> m >> k;
		for (int i = 1; i <= n; i++) cin >> A[i];
		int s = 1;
		int e = n;
		if (k >= m) k = m - 1;
		int mi = MAX;
		while (k > 0) {
			mi = MAX;
			int idx;
			for (int i = s; i <= m-1; i++) {
				if (mi > A[i]) {
					mi = A[i];
					idx = i;
				}
			}
			for (int i = e; i > n - m+1; i--) {
				if (mi > A[i]) {
					mi = A[i];
					idx = i;
				}
			}
			if (idx <= s + k -1) {
				k -= idx - s + 1;
				m -= idx - s + 1;
				s = idx + 1;
			}
			else if (idx >= e - k + 1) {
				k -= e - idx + 1;
				m -= idx - e + 1;
				e = idx - 1;
			}
			else {
				break;
			}
		}
		if (k <= 0) {
			mi = MAX;
			for (int i = s; i < s + m - 1; i++) {
				mi = min(A[i], mi);
			}
			for (int i = e; i > e - m + 1; i--) {
				mi = min(A[i], mi);
			}
			if(m == 1) mi = min(mi, max(A[s], A[e]));
		}

		cout << mi << '\n';

	/*	int mi = MAX;
		if (m == 1) mi = max(A[s], A[e]);
		for (int i = s; i < s + m-1; i++) {
			mi = min(mi, A[i]);
		}
		for (int i = e; i > e - m+1; i--) {
			mi = min(mi, A[i]);
		}*/
	//	cout << mi << '\n';
	}

}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = n - k;
      int x = m - k - 1;
      d = d - x - 1;
      // trace(d);
      for (int i = 0; i < n - d; i++) {
        arr[i] = max(vec[i], vec[i + d]);
      }
      // for (int i = n - d; i < n; i++) {
      //   arr[i] = arr[i - d];
      // }
      // out(arr);
      vector <int> temp;
      deque <int> qu;
      int r = m - d;
      r %= (n - k);
      if (r == 0) r = 1;
      // trace(r);
      for (int i = 0; i < r; i++) {
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      for (int i = r; i < n - d; i++) {
        temp.pb(arr[qu.front()]);
        while (!qu.empty() && qu.front() <= i - r) {
          qu.pop_front();
        }
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      temp.pb(arr[qu.front()]);
      // out(temp);
      // sort(temp.begin(), temp.begin() + n - k - 1);
      sort(all(temp));
      ans = temp[k];
    }
    cout << ans << endl;
  }

  return 0;
}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = n - m;
      // trace(d);
      for (int i = 0; i < n - d; i++) {
        arr[i] = max(vec[i], vec[i + d]);
      }
      // for (int i = n - d; i < n; i++) {
      //   arr[i] = arr[i - d];
      // }
      // out(arr);
      vector <int> temp;
      deque <int> qu;
      int r = (n - k) - d;
      // trace(r);
      for (int i = 0; i < r; i++) {
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      for (int i = r; i >= 0 && i < n && i < n - d; i++) {
        temp.pb(arr[qu.front()]);
        while (!qu.empty() && qu.front() <= i - r) {
          qu.pop_front();
        }
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      if (!qu.empty()) temp.pb(arr[qu.front()]);
      // out(temp);
      // sort(temp.begin(), temp.begin() + n - k - 1);
      sort(all(temp));
      if (k < temp.size()) ans = temp[k];
    }
    cout << ans << endl;
  }

  return 0;
}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = n - k;
      int x = m - k - 1;
      d = d - (x + 1);
      d %= (n - k);
      // trace(d);
      for (int i = 0; i < n - d; i++) {
        arr[i] = max(vec[i], vec[i + d]);
      }
      for (int i = n - d; i < n; i++) {
        arr[i] = arr[i - d];
      }
      // out(arr);
      vector <int> temp;
      deque <int> qu;
      int r = m - d;
      r %= (n - k);
      if (r == 0) r = 1;
      // trace(r);
      for (int i = 0; i < r; i++) {
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      for (int i = r; i < n - d; i++) {
        temp.pb(arr[qu.front()]);
        while (!qu.empty() && qu.front() <= i - r) {
          qu.pop_front();
        }
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      temp.pb(arr[qu.front()]);
      // out(temp);
      // sort(temp.begin(), temp.begin() + n - k - 1);
      sort(all(temp));
      ans = temp[k];
    }
    cout << ans << endl;
  }

  return 0;
}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = n - k;
      int x = m - k - 1;
      d = d - x - 1;
      // trace(d);
      for (int i = 0; i < n && i < n - d; i++) {
        if (i + d < n) arr[i] = max(vec[i], vec[i + d]);
      }
      for (int i = n - d; i < n; i++) {
        if (i - d >= 0) arr[i] = arr[i - d];
      }
      // out(arr);
      vector <int> temp;
      deque <int> qu;
      int r = m - d;
      r %= (n - k);
      if (r == 0) r = 1;
      // trace(r);
      for (int i = 0; i < r; i++) {
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      for (int i = r; i < n && i < n - d; i++) {
        temp.pb(arr[qu.front()]);
        while (!qu.empty() && qu.front() <= i - r) {
          qu.pop_front();
        }
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      if (!qu.empty()) temp.pb(arr[qu.front()]);
      // out(temp);
      // sort(temp.begin(), temp.begin() + n - k - 1);
      sort(all(temp));
      if (k < temp.size()) ans = temp[k];
    }
    cout << ans << endl;
  }

  return 0;
}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = m - k;
      d %= (n - k);
      // trace(d);
      for (int i = 0; i < n - d; i++) {
        arr[i] = max(vec[i], vec[i + d]);
      }
      for (int i = n - d; i < n; i++) {
        arr[i] = arr[i - d];
      }
      // out(arr);
      // vector <int> temp;
      // deque <int> qu;
      // int r = n - k;
      // r %= n;
      // if (r == 0) r = 1;
      // for (int i = 0; i < r; i++) {
      //   while (!qu.empty() && arr[qu.back()] <= arr[i])
      //     qu.pop_back();
      //   qu.push_back(i);
      // }
      // for (int i = r; i < n; i++) {
      //   temp.pb(arr[qu.front()]);
      //   while (!qu.empty() && qu.front() <= i - r) {
      //     qu.pop_front();
      //   }
      //   while (!qu.empty() && arr[qu.back()] <= arr[i])
      //     qu.pop_back();
      //   qu.push_back(i);
      // }
      // temp.pb(arr[qu.front()]);
      // out(temp);
      // sort(all(temp));
      sort(arr.begin(), arr.begin() + n - d);
      ans = arr[k];
    }
    cout << ans << endl;
  }

  return 0;
}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = n - k;
      int x = m - k - 1;
      d = d - x - 1;
      // trace(d);
      for (int i = 0; i < n - d; i++) {
        arr[i] = max(vec[i], vec[i + d]);
      }
      // for (int i = n - d; i < n; i++) {
      //   arr[i] = arr[i - d];
      // }
      // out(arr);
      vector <int> temp;
      deque <int> qu;
      int r = x;
      // trace(r);
      for (int i = 0; i < r; i++) {
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      for (int i = r; i >= 0 && i < n && i < n - d; i++) {
        temp.pb(arr[qu.front()]);
        while (!qu.empty() && qu.front() <= i - r) {
          qu.pop_front();
        }
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      if (!qu.empty()) temp.pb(arr[qu.front()]);
      // out(temp);
      // sort(temp.begin(), temp.begin() + n - k - 1);
      sort(all(temp));
      if (k < temp.size()) ans = temp[k];
    }
    cout << ans << endl;
  }

  return 0;
}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = n - k;
      int x = m - k - 1;
      d = d - x - 1;
      // trace(d);
      for (int i = 0; i < n - d; i++) {
        arr[i] = max(vec[i], vec[i + d]);
      }
      for (int i = n - d; i < n; i++) {
        arr[i] = arr[i - d];
      }
      // out(arr);
      vector <int> temp;
      deque <int> qu;
      int r = x;
      // trace(r);
      for (int i = 0; i < r; i++) {
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      for (int i = r; i >= 0 && i < n && i < n - d; i++) {
        temp.pb(arr[qu.front()]);
        while (!qu.empty() && qu.front() <= i - r) {
          qu.pop_front();
        }
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      if (!qu.empty()) temp.pb(arr[qu.front()]);
      // out(temp);
      // sort(temp.begin(), temp.begin() + n - k - 1);
      sort(all(temp));
      if (k < temp.size()) ans = temp[k];
    }
    cout << ans << endl;
  }

  return 0;
}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = m - k;
      d %= (n - k);
      // trace(d);
      for (int i = 0; i < n - d; i++) {
        arr[i] = max(vec[i], vec[i + d]);
      }
      for (int i = n - d; i < n; i++) {
        arr[i] = arr[i - d];
      }
      // out(arr);
      vector <int> temp;
      deque <int> qu;
      int r = m - k;
      r %= n;
      if (r == 0) r = 1;
      for (int i = 0; i < r; i++) {
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      for (int i = r; i < n; i++) {
        temp.pb(arr[qu.front()]);
        while (!qu.empty() && qu.front() <= i - r) {
          qu.pop_front();
        }
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      temp.pb(arr[qu.front()]);
      // out(temp);
      sort(temp.begin(), temp.begin() + n - k - 1);
      ans = temp[k];
    }
    cout << ans << endl;
  }

  return 0;
}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = n - k;
      int x = m - k - 1;
      d = d - x - 1;
      // trace(d);
      for (int i = 0; i < n - d; i++) {
        if (i + d < n) arr[i] = max(vec[i], vec[i + d]);
      }
      for (int i = n - d; i < n; i++) {
        if (i - d >= 0) arr[i] = arr[i - d];
      }
      // out(arr);
      vector <int> temp;
      deque <int> qu;
      int r = m - d;
      r %= (n - k);
      if (r == 0) r = 1;
      // trace(r);
      for (int i = 0; i < r; i++) {
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      for (int i = r; i < n - d; i++) {
        temp.pb(arr[qu.front()]);
        while (!qu.empty() && qu.front() <= i - r) {
          qu.pop_front();
        }
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      if (!qu.empty()) temp.pb(arr[qu.front()]);
      // out(temp);
      // sort(temp.begin(), temp.begin() + n - k - 1);
      sort(all(temp));
      ans = temp[k];
    }
    cout << ans << endl;
  }

  return 0;
}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = m - k;
      d %= (n - k);
      // trace(d);
      for (int i = 0; i < n - d; i++) {
        arr[i] = max(vec[i], vec[i + d]);
      }
      for (int i = n - d; i < n; i++) {
        arr[i] = arr[i - d];
      }
      // out(arr);
      vector <int> temp;
      deque <int> qu;
      int r = m - d;
      r %= (n - k);
      if (r == 0) r = 1;
      // trace(r);
      for (int i = 0; i < r; i++) {
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      for (int i = r; i < n - d; i++) {
        temp.pb(arr[qu.front()]);
        while (!qu.empty() && qu.front() <= i - r) {
          qu.pop_front();
        }
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      temp.pb(arr[qu.front()]);
      // out(temp);
      // sort(temp.begin(), temp.begin() + n - k - 1);
      sort(all(temp));
      ans = temp[k];
    }
    cout << ans << endl;
  }

  return 0;
}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = n - k;
      int x = m - k - 1;
      d = d - x - 1;
      assert(d >= 0);
      // trace(d);
      for (int i = 0; i < n - d; i++) {
        arr[i] = max(vec[i], vec[i + d]);
      }
      // for (int i = n - d; i < n; i++) {
      //   arr[i] = arr[i - d];
      // }
      // out(arr);
      vector <int> temp;
      deque <int> qu;
      int r = x;
      // trace(r);
      for (int i = 0; i < r; i++) {
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      for (int i = r; i >= 0 && i < n && i < n - d; i++) {
        temp.pb(arr[qu.front()]);
        while (!qu.empty() && qu.front() <= i - r) {
          qu.pop_front();
        }
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      if (!qu.empty()) temp.pb(arr[qu.front()]);
      // out(temp);
      // sort(temp.begin(), temp.begin() + n - k - 1);
      sort(all(temp));
      if (k < temp.size()) ans = temp[k];
    }
    cout << ans << endl;
  }

  return 0;
}


/*input
4
6 4 2
2 9 2 3 8 5
4 4 1
2 13 60 4
4 1 3
1 2 2 1
2 2 0
1 2

*/

/*
                                                    ______________
                                                          |       )
                                                          |   )   /
                                                          |______/
                                                    |     |      \
                                                    |     |   )   \
                                                    |_____|_______)

*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
int mod = 1000000007;
const int inf = 1034567891;
const ll LL_INF = 1234567890123456789ll;
#define PI 3.14159265
#define endl '\n'
#define F first
#define S second
#define debug(x) cout << #x << " = " << x << endl;
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define out(container) for (auto it : container) cout << it << " "; cout << endl;

template < typename T > T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > string toString(T a)       { return to_string(a); }
template < typename T > void toInt(string s, T &x) { stringstream str(s); str >> x;}
inline int add(int x, int y){ x += y; if(x >= mod) x -= mod; return x;}
inline int sub(int x, int y){ x -= y; if(x < 0) x += mod; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % mod;}
inline int powr(int a, ll b){
  int x = 1 % mod;
  while(b){
    if(b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a){ return powr(a, mod - 2);}

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

  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector <int> vec, arr(n, 0);
    int v;
    for (int i = 0; i < n; i++) {
      cin >> v;
      vec.pb(v);
    }
    int ans = 0;
    if (k >= m) {
      int mx = 0;
      for (int i = 0; i < m; i++) {
        mx = max(mx, vec[i]);
        mx = max(mx, vec[n - i - 1]);
      }
      ans = mx;
    } else {
      int d = n - k;
      int x = m - k - 1;
      d = d - x - 1;
      // trace(d);
      for (int i = 0; d >= 0 && i < n - d; i++) {
        if (i + d < n) arr[i] = max(vec[i], vec[i + d]);
      }
      for (int i = n - d; i < n; i++) {
        if (i - d >= 0) arr[i] = arr[i - d];
      }
      // out(arr);
      vector <int> temp;
      deque <int> qu;
      int r = m - d;
      r %= (n - k);
      if (r == 0) r = 1;
      // trace(r);
      for (int i = 0; i < r; i++) {
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      for (int i = r; d >= 0 && i < n - d; i++) {
        temp.pb(arr[qu.front()]);
        while (!qu.empty() && qu.front() <= i - r) {
          qu.pop_front();
        }
        while (!qu.empty() && arr[qu.back()] >= arr[i])
          qu.pop_back();
        qu.push_back(i);
      }
      if (!qu.empty()) temp.pb(arr[qu.front()]);
      // out(temp);
      // sort(temp.begin(), temp.begin() + n - k - 1);
      sort(all(temp));
      if (k < temp.size()) ans = temp[k];
    }
    cout << ans << endl;
  }

  return 0;
}