#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
typedef struct node
{
int x;int y;int h;
}Node;
Node save[4001];
int a[6001]={0};
int cc[12001]={0};
int c=0;
int max(Node a[],int n)
{
int i;
int maxx=a[0].y;
for(i=1;i<n;i++)
{
if(a[i].y>maxx) maxx=a[i].y;
}
return maxx;
}
int min(Node a[],int n)
{
int i;
int minn=a[0].x;
for(i=1;i<n;i++)
{
if(a[i].x<minn) minn=a[i].x;
}
return minn;
}
int main()
{
int n,i,j;
cin>>n;
for(i=0;i<n;i++)
{
cin>>save[i].x>>save[i].h>>save[i].y;
}
int maxx=max(save,n);int max1=maxx+3000;
int minn=min(save,n);int min1=minn+3000;
for(i=0;i<n;i++)
{
for(j=save[i].x;j<save[i].y;j++)
{
if(a[j+3000]<save[i].h)
{
a[j+3000]=save[i].h;
}
}
}
for(i=min1;i<max1;i++)
{
if(i==min1)
{
cc[c++]=i-3000;cc[c++]=a[i];
}
else
{
if(a[i-1]==a[i]) continue;
else if(a[i-1]!=a[i])
{
cc[c++]=i-3000;cc[c++]=a[i];
}
}
}
cc[c++]=max1-3000;cc[c++]=0;
for(i=0;i<c;i++)
{
if(i==0) cout<<cc[i];
else cout<<" "<<cc[i];
}
return 0;
}