//#define MY_DEBUG 10
//-------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <string.h>
#include <algorithm>

#ifdef MY_DEBUG
  #include <conio>
  #include <fstream>
  #pragma hdrstop
  #include <system.hpp>
  #pragma argsused
#endif
using namespace std;
#pragma comment(linker, "/STACK:16777216")

//global variable;
#define PI 3.1415926535897932384626433832795
#ifdef MY_DEBUG
  ifstream in("in.txt",ios::in | ios::binary);
  ofstream out("out.txt",ios::out | ios::binary);
#endif
//function
//class
class Task
{
  //global variable
  int N;
  int res;
  int kol;
  bool graph[256][256];
  int coor[256][4];
  bool mas[256];
 public:
  Task()
  {
  }
  ~Task()
  {
  }
  //this is my code
  void ReadData()
  {
    #ifdef MY_DEBUG
      //here reading in file
      in >> N;
      for(int i = 0;i < N;++i)
        in >> coor[i][0] >> coor[i][1] >> coor[i][2] >> coor[i][3];
    #endif
    #ifndef MY_DEBUG
      //here standart reading
      cin >> N;
      for(int i = 0;i < N;++i)
        cin >> coor[i][0] >> coor[i][1] >> coor[i][2] >> coor[i][3];
    #endif
  }
  void OutData()
  {
    #ifdef MY_DEBUG
      //here writing in file
      cout << res;
    #endif
    #ifndef MY_DEBUG
      //here writing in consol
      cout << res;
    #endif
  }
int per(int x1,register int x2,register int x3,register int x4)
{
  if(x1 > x2)
  {
    int t = x1;
    x1 = x2;
    x2 = t;
  }
  if(x3 > x4)
  {
    int t = x3;
    x3 = x4;
    x4 = t;
  }
  if(x1 >= x3 && x2 <= x4)
    return x2 - x1;
  else
  if(x3 >= x1 && x4 <= x2)
    return x4 - x3;
  else
  if(x3 >= x1 && x3 <= x2)
    return x2 - x3;
  else
  if(x4 >= x1 && x4 <= x2)
    return x4 - x1;
  else
  if(x1 >= x3 && x1 <= x4)
    return x4 - x1;
  else
  if(x2 >= x3 && x2 <= x4)
    return x2 - x3;
  else
    return -1;
}
  void Rec(int *i,int ni)
  {
    int z[256];
    int nz = 0;
    for(int l = 0;l < ni;++l)
    {
      for(int j = 0;j < N;++j)
      {
        if(mas[j] == 0)
        {
          if(graph[i[l]][j])
          {
            z[nz++] = j;
            mas[j] = 1;
            ++kol;
          }
        }
      }
    }
    if(nz > 0)
      Rec(z,nz);
  }
  void Solve()
  {
    //here solving problem

    for(int i = 0;i < N;++i)
    {
      for(int j = 0;j < N;++j)
      {
        if(i == j)
          graph[i][j] = 0;
        else
        {
          int l1 = per(coor[i][0],coor[i][2],coor[j][0],coor[j][2]);
          int l2 = per(coor[i][1],coor[i][3],coor[j][1],coor[j][3]);
          if(l1 == -1 || l2 == -1)
            graph[i][j] = 0;
          else
            graph[i][j] = 1;
        }
      }
    }
 /*   #ifdef MY_DEBUG
    N = 200;
    for(int i = 0;i < N - 1;++i)
    {
      graph[i][i + 1] = 1;
    }
    #endif */

    int z[256];
    int nz = 1;
    res = 1;
    memset(mas,0,sizeof(bool)*256);
    for(int i = 0;i < N;++i)
    {
      if(mas[i] == 0)
      {
        mas[i] = 1;
        z[0] = i;
        nz = 1;
        kol = 1;
        Rec(z,nz);
        res = max(res,kol);
      }
    }
  }
};
int main(int argc, char* argv[])
{
  Task a;
  #ifdef MY_DEBUG
    TDateTime time,time2;
    time = time.CurrentDateTime();
  #endif
  a.ReadData();
  a.Solve();
  a.OutData();
  #ifdef MY_DEBUG
    time2 = time2.CurrentDateTime() - time;
    unsigned  short msec,sec,h,m;
    time2.DecodeTime(&h,&m,&sec,&msec);
    cout<<endl<<"Solve Time: "<<sec<<":"<<msec<<endl;
    in.close();
    out.close();
    getch();
  #endif
  return 0;
}
//---------------------------------------------------------------------------


