// Complexity O(log(n)+log(m))
#include<bits/stdc++.h>
using namespace std;
#define f(i,x,y) for(int i = (x);i < (y);++i)
#define F(i,x,y) for(int i = (x);i > (y);--i)
int max(int a,int b){return (a > b?a:b);}
int min(int a,int b){return (a < b?a:b);}
int mod(int a){return (a > 0?a:((-1)*(a)));}
#define INF 1000000
int func(int *arr1,int *arr2,int sz1,int sz2,int k)
{
if((k <= (sz1+sz2))&&(k > 0))
{
int s = 1,e,i,j;
if(k > sz1)e = sz1+1;
else e = k;
while((e-s)>1)
{
i = (e+s)/2;
j = ((k-1)-(i-1));
j++;
if(j > (sz2+1)){s = i;}
else if((arr1[i] >= arr2[j-1])&&(arr1[i] <= arr2[j]))return arr1[i];
else if((arr2[j] >= arr1[i-1])&&(arr2[j] <= arr1[i]))return arr2[j];
else if(arr1[i] < arr2[j-1]){s = i;}
else if(arr1[i] > arr2[j]){e = i;}
else {;}
}
i = e,j = ((k-1)-(i-1));j++;
if((arr1[i] >= arr2[j-1])&&(arr1[i] <= arr2[j]))return arr1[i];
else if((arr2[j] >= arr1[i-1])&&(arr2[j] <= arr1[i]))return arr2[j];
else
{
i = s,j = ((k-1)-(i-1));j++;
if((arr1[i] >= arr2[j-1])&&(arr1[i] <= arr2[j]))return arr1[i];
else return arr2[j];
}
}
else
{
cout << "Data Invalid" << endl;
return -INF;
}
}
int main()
{
int n,m,k;
cin >> n >> m >> k;
int arr1[n+2];
int arr2[m+2];
f(i,1,n+1)
cin >> arr1[i];
f(i,1,m+1)
cin >> arr2[i];
arr1[0] = -INF;
arr2[0] = -INF;
arr1[n+1] = +INF;
arr2[m+1] = +INF;
int val = func(arr1,arr2,n,m,k);
if(val != -INF)cout << val << endl;
return 0;
}
CiAgICAvLyBDb21wbGV4aXR5ICAgIE8obG9nKG4pK2xvZyhtKSkKCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgZihpLHgseSkgZm9yKGludCBpID0gKHgpO2kgPCAoeSk7KytpKQojZGVmaW5lIEYoaSx4LHkpIGZvcihpbnQgaSA9ICh4KTtpID4gKHkpOy0taSkKaW50IG1heChpbnQgYSxpbnQgYil7cmV0dXJuIChhID4gYj9hOmIpO30KaW50IG1pbihpbnQgYSxpbnQgYil7cmV0dXJuIChhIDwgYj9hOmIpO30KaW50IG1vZChpbnQgYSl7cmV0dXJuIChhID4gMD9hOigoLTEpKihhKSkpO30KI2RlZmluZSBJTkYgMTAwMDAwMAoKCgppbnQgZnVuYyhpbnQgKmFycjEsaW50ICphcnIyLGludCBzejEsaW50IHN6MixpbnQgaykKewogIGlmKChrIDw9IChzejErc3oyKSkmJihrID4gMCkpCiAgewogICAgaW50IHMgPSAxLGUsaSxqOwogICAgaWYoayA+IHN6MSllID0gc3oxKzE7CiAgICBlbHNlIGUgPSBrOwogICAgd2hpbGUoKGUtcyk+MSkKICAgIHsKICAgICAgaSA9IChlK3MpLzI7CiAgICAgIGogPSAoKGstMSktKGktMSkpOyAKICAgICAgaisrOwogICAgICBpZihqID4gKHN6MisxKSl7cyA9IGk7fQogICAgICBlbHNlIGlmKChhcnIxW2ldID49IGFycjJbai0xXSkmJihhcnIxW2ldIDw9IGFycjJbal0pKXJldHVybiBhcnIxW2ldOwogICAgICBlbHNlIGlmKChhcnIyW2pdID49IGFycjFbaS0xXSkmJihhcnIyW2pdIDw9IGFycjFbaV0pKXJldHVybiBhcnIyW2pdOwogICAgICBlbHNlIGlmKGFycjFbaV0gPCBhcnIyW2otMV0pe3MgPSBpO30KICAgICAgZWxzZSBpZihhcnIxW2ldID4gYXJyMltqXSl7ZSA9IGk7fQogICAgICBlbHNlIHs7fQogICAgfQogICAgaSA9IGUsaiA9ICgoay0xKS0oaS0xKSk7aisrOwogICAgaWYoKGFycjFbaV0gPj0gYXJyMltqLTFdKSYmKGFycjFbaV0gPD0gYXJyMltqXSkpcmV0dXJuIGFycjFbaV07CiAgICBlbHNlIGlmKChhcnIyW2pdID49IGFycjFbaS0xXSkmJihhcnIyW2pdIDw9IGFycjFbaV0pKXJldHVybiBhcnIyW2pdOwogICAgZWxzZQogICAgewogICAgICBpID0gcyxqID0gKChrLTEpLShpLTEpKTtqKys7CiAgICAgIGlmKChhcnIxW2ldID49IGFycjJbai0xXSkmJihhcnIxW2ldIDw9IGFycjJbal0pKXJldHVybiBhcnIxW2ldOwogICAgICBlbHNlIHJldHVybiBhcnIyW2pdOwogICAgfQogIH0KICBlbHNlCiAgewogICAgY291dCA8PCAiRGF0YSBJbnZhbGlkIiA8PCBlbmRsOwogICAgcmV0dXJuIC1JTkY7CiAgfQp9CgoKCgppbnQgbWFpbigpCnsKICBpbnQgbixtLGs7CiAgY2luID4+IG4gPj4gbSA+PiBrOwogIGludCBhcnIxW24rMl07CiAgaW50IGFycjJbbSsyXTsKICBmKGksMSxuKzEpCiAgICBjaW4gPj4gYXJyMVtpXTsKICAgIGYoaSwxLG0rMSkKICAgIGNpbiA+PiBhcnIyW2ldOwogIGFycjFbMF0gPSAtSU5GOwogIGFycjJbMF0gPSAtSU5GOwogIGFycjFbbisxXSA9ICtJTkY7CiAgYXJyMlttKzFdID0gK0lORjsgCiAgaW50IHZhbCA9IGZ1bmMoYXJyMSxhcnIyLG4sbSxrKTsKICBpZih2YWwgIT0gLUlORiljb3V0IDw8IHZhbCA8PCBlbmRsOyAgIAogIHJldHVybiAwOwp9Cg==