#include <iostream> using namespace std; struct Node { int val1; Node* next1; Node(int x1):val1(x1),next1(nullptr){}; Node():val1(0),next1(nullptr){}; }; int main() { int n1,tmp1; Node* head,*cur1; while (cin>>n1) { head=new Node(-1); cur1=head; while(0<n1--) { cin>>tmp1; cur1->next1=new Node(tmp1); cur1=cur1->next1; } Node* p=head,*q=head; int k;cin>>k; while (0<k--) { p=p->next1; } while (p!=nullptr) { p=p->next1; q=q->next1; } cout<<q->val1<<endl; // while (head!=nullptr) // { // cur1=head->next1; // delete head; // } } }