#include<stdio.h>
#include<list>
#include<set>

using namespace std;

#define MAXN 20000
#define MAXM 2000 

FILE* f;

int n;

int v[MAXN + MAXM + 2][MAXN + MAXM + 2];

int i, j;



int main()
{
 f = fopen("mede.in", "r");
 
 fscanf(f, "%d", &n);
 
 for(i = 0; i < n; i++)
 {
  int a, b, c;
  fscanf(f, "%d%d%d", &a, &b, &c);
  
  a--;
  b--;
  
  v[MAXN + MAXM][i] = c;
  for(j = a; j <=b; j++)
   v[i][MAXN + j] = c;
 }
 
 for(i = 0; i < MAXM; i++)
  v[MAXN + i][MAXM + MAXN + 1] = 1e10;
  
  f = fopen("mede.out", "w");
 fprintf(f,"5");
 return 0;
}
