#include<stdio.h>
typedef struct student{
long no;
char name[9];
int score;
}Student;//为结构体类型struct student起别名Student
void input(Student stu[], int n){//读入n个学生的数据
for(int i = 0; i < n; i++){
scanf("%ld", &stu[i].no);
scanf("%s", stu[i].name);
scanf("%d", &stu[i].score);
}
}
//查找学号为xh的学生,不存在返回-1,存在则返回其下标
int search(Student stu[], int n, long no){
int index = -1;
for(int i = 0; i < n; i++){
if(no == stu[i].no){
index = i;
break;
}
}
return index;
}
void print(Student stu[], int t){//输出第t个学生的信息
printf("%ld %s %d\n", stu[t].no, stu[t].name, stu[t].score);
}
int main(){
int i, n, m ,t;
long xh;
struct student stu[100];
while(scanf("%d", &n) != EOF){
input(stu, n);//读入n个学生的数据
scanf("%d", &m);
for(i = 0; i < m; i++){
scanf("%ld", &xh);
t = search(stu, n, xh);//查找学号为xh的学生,不存在返回-1,存在则返回其下标
if(t == -1)
printf("%d not exist\n", xh);
else
print(stu, t);//输出第t个学生的信息
}
}
return 0;
}