#include <stdio.h>
#include <stdlib.h>
struct man
{
char name[20];
int hight,weight;
} boy[ 1001],reboy[1001],T;
int main()
{
int count,i,N,j,a,b,c,d;
count=0;
scanf("%d",&N);
for(i=0; i<N; i++)
{
scanf("%s %d %d",boy[i].name,&boy[i].hight,&boy[i].weight);
}
scanf("%d%d%d%d",&a,&b,&c,&d);
for(i=0; i<N; i++)
{
if(boy[i].hight>=a&&boy[i].hight<=b&&boy[i].weight>=c&&boy[i].weight<=d)
{
reboy[count]=boy[i];
count++;
}
}
for(i=0; i<count-1; i++)
{
for(j=0; j+1<count; j++)
{
if(reboy[j].hight>reboy[j+1].hight)
{
T=reboy[j];
reboy[j]=reboy[j+1];
reboy[j+1]=T;
}
if(reboy[j].hight==reboy[j+1].hight&&reboy[j].weight>reboy[j+1].weight)
{
T=reboy[j];
reboy[j]=reboy[j+1];
reboy[j+1]=T;
}
}
}
if(count==0)printf("No\n");
else
for(i=0; i<count; i++)
printf("%s %d %d\n",reboy[i].name,reboy[i].hight,reboy[i].weight);
return 0;
}