#include <stdio.h>
struct Student
{
long long int ID;
int D;
int C;
}; // 取个student别名为毛?你后面用了吗?
void classified(struct Student student[], int N,int H,int L); // 传入student
void order(struct Student student[], int *a,int n);
int main(void)
{
int N,L,H;
scanf("%d %d %d",&N,&L,&H);
struct Student student[N]; // 不想用全局变量,函数中传参过去
int i;
for(i=0;i<N;i++)
{
scanf("%lld %d %d",&student[i].ID,&student[i].D,&student[i].C);
}
classified(student, N,H,L); // 传入student
}
void classified(struct Student student[],int N,int H,int L)
{
int i,j,k,l,o,sum;
j=k=l=o=0;
int a[N],b[N],c[N],d[N];
for(i=0;i<N;i++)
{
if(student[i].D>=H && student[i].C>=H)
{
a[j++]=i;
}
else if(student[i].D>=H &&student[i].C>=L)
{
b[k++]=i;
}
else if(student[i].D>=L && student[i].C>=L && student[i].D>student[i].C) // 是student[i] 不是 student
{
c[l++]=i;
}
else if(student[i].D>=L && student[i].C>=L)
{
d[o++]=i;
}
}
printf("%d\n",j+k+l+o-4);
// 传入student
order(student, a,j-1);
order(student, b,k-1);
order(student, c,l-1);
order(student, d,o-1);
}
void order(struct Student student[],int *a,int n)
{
struct Student temp;
int i,j;
for(i=0;i<n;i++)
{
for(j=i+1;j<n-i;j++)
{
if(student[a[i]].D +student[a[i]].C <student[a[i+1]].D+student[a[i+1]].C)
{
temp=student[a[i+1]];
student[a[i+1]]=student[a[i]];
student[a[i+1]]=temp;
}
}
}
for(i=0;i<n;i++)
{
printf("%lld %d %d\n",student[i].ID,student[i].D,student[i].C );
}
}