#include <bits/stdc++.h>
using namespace std;
struct ListNode
{
int val;
ListNode* next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next_) : val(x), next(next_) {}
};
int main() {
int a, b, c;
stack<ListNode*> m;
while(cin >> a )
{
struct ListNode* ret= new ListNode();
ListNode* cur= ret;
while (a--) {
cin >> b;
struct ListNode *temp = new ListNode(b);
cur->next = temp;
m.push(cur->next);
cur = cur->next;
}
cin >> c;
while(!m.empty())
{
ListNode* p = m.top();
m.pop();
c--;
if(c==0)
{
cout << p->val<<'\n';
break;
}
}
}
}
// 64 位输出请用 printf("%lld")