#include<bits/stdc++.h>
using namespace std;
/*分析:轮廓线即需要找到出现折点的地方
从整个建筑群最左遍历到最右,如果中间出现高度
不一致的点,该点及其高度加入到结果数组
*/
const int N = 1e5 + 5;
struct build{
int l,h,r;
};
build b[5005];
int res[N],id; // res:存轮廓线x,y坐标 id:数组下标
int n,lt=10000,rt=0; //lt:最左边界 rt:最右边界
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>b[i].l>>b[i].h>>b[i].r;
lt = min(lt,b[i].l);
rt = max(rt,b[i].r);
}
int h_last = 0;//上一个高度
for(int x=lt;x<=rt;x++){ //扫描整个x坐标
int h_now = 0 ; //当前线的高度(有些坐标不在建筑范围内,高度为0)
for(int i=1;i<=n;i++){ //遍历所有建筑,找出当前坐标的最高高度
int h_x = b[i].h; //x点在建筑上的高度
if(x >= b[i].l && x < b[i].r){ //x点在第i个建筑范围内
h_now = max(h_now, h_x);
}
}
//当前高度和上一个高度不一致,说明出现轮廓点(折点)
if(h_last != h_now){
res[++id] = x;
res[++id] = h_now;
h_last = h_now; //更新上一个高度
}
}
for(int i=1;i<=id;i++){
cout<<res[i]<<" ";
}
return 0;
}