链表,不知道后面该怎么写```pascal
#include
#include<stdlib.h>
using namespace std;
struct node
{
int bh,sx;//下一个的编号 输入时的顺序
node *next;//下一个的地址
};
int n;//共有 n个小朋友
int sr;//输入的“下一位编号”
node *head,*tail,*p;
int main()
{
cin>>n;
head=new node;
tail=head;
for(int i=1;i<=n;i++)
{
cin>>sr;
p=new node;
p->sx=i;
p->bh=sr;
p->next=NULL;
tail->next=p;
tail=p;
}
}