#include <cstddef> #include <iostream> using namespace std; struct ListNode{ int m_nKey; ListNode* m_pNext; }; int main() { int n,num,k; while (cin>>n) { ListNode* head = nullptr; ListNode* tail = nullptr; for (int i = 0; i < n; i++) { cin>>num; ListNode* node = new ListNode; node->m_nKey = num; node->m_pNext = nullptr; if (head == nullptr){ head = node; } else{ tail->m_pNext = node; } tail = node; } cin>>k; ListNode* i = head; ListNode* j = head; k = k - 1; while(k--){ if (j == nullptr) break; j = j->m_pNext; } if (j != nullptr){ while(j != tail){ i = i->m_pNext; j = j->m_pNext; } cout<<i->m_nKey<<endl; } } }