#include <stdio.h>
#include <string.h>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
struct student
{
char id[30];
int Gm;
int Gf;
int G;
int point;
student()
{
Gm=-1;
Gf=-1;
G=-1;
point=-1;
}
}stu[100010];
map<string,int> mp1;
map<int,string> mp2;
int N,M,K;
bool cmp(student a,student b)
{
if(a.G!=b.G)return a.G>b.G;
else return strcmp(a.id,b.id)<0;
}
int main()
{
int num=0;
scanf("%d%d%d",&N,&M,&K);
char id[30];
int score;
for(int i=0;i<N;i++)
{
scanf("%s %d",&id,&score);
if(mp1.find(id)==mp1.end())
{
mp1[id]=num;
mp2[num]=id;
strcpy(stu[num].id,id);
num++;
}
int index=mp1[id];
stu[index].point=score;
}
for(int i=0;i<M;i++)
{
scanf("%s %d",&id,&score);
if(mp1.find(id)==mp1.end())
{
mp1[id]=num;
mp2[num]=id;
strcpy(stu[num].id,id);
num++;
}
int index=mp1[id];
stu[index].Gm=score;
}
for(int i=0;i<K;i++)
{
scanf("%s %d",&id,&score);
if(mp1.find(id)==mp1.end())
{
mp1[id]=num;
mp2[num]=id;
strcpy(stu[num].id,id);
num++;
}
int index=mp1[id];
stu[index].Gf=score;
if(stu[index].Gm>stu[index].Gf)
{
stu[index].G=0.4*stu[index].Gm+0.6*stu[index].Gf+0.5;
}
else
{
stu[index].G=stu[index].Gf;
}
}
sort(stu,stu+num,cmp);
for(int i=0;i<num;i++)
{
if(stu[i].G>=60&&stu[i].point>=200)
{
printf("%s %d %d %d %d\n",stu[i].id,stu[i].point,stu[i].Gm,stu[i].Gf,stu[i].G);
}
}
return 0;
}