#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
struct student{
string id;
int g1 = -1;//编程
int g2 = -1;//期中
int g3 = -1;//期末
int g4 = -1;//总评
};
bool cmp2(student a,student b){
if(a.g4 == b.g4) return a.id < b.id;
return a.g4 > b.g4;
}
int main()
{
int P,M,N,cnt = 0,num;
string cid;
student stu[10000];
cin >> P >> M >> N;
for(int i = 0;i < P;i++){
cin >> stu[i].id >> stu[i].g1;
if(stu[i].g1 < 200) i--,P--;
}
for(int i = 0;i < M;i++){
bool flag = true;
cin >> cid >> num;
for(int j = 0;j < P;j++)
if(stu[j].id == cid){
stu[j].g2 = num;
break;
}
}
for(int i = 0;i < N;i++){
bool flag = true;
cin >> cid >> num;
if(num < 34){
i--,N--;
continue;
}
for(int j = 0;j < P;j++)
if(stu[j].id == cid){
stu[j].g3 = num;
break;
}
}
for(int i = 0;i < P;i++)
if(stu[i].g2 > stu[i].g3)
stu[i].g4 = (stu[i].g2*0.4 + stu[i].g3*0.6)+0.5;
else stu[i].g4 = stu[i].g3;
sort(stu,stu+P,cmp2);
for(int i = 0;i < P;i++)
if(stu[i].g4 >= 60)
cout << stu[i].id <<" " << stu[i].g1 << " "<<stu[i].g2 <<" " << stu[i].g3 << " " << stu[i].g4<<endl;
return 0;
}