program gunner;

{$N+}

const
  NMAX = 1000;
  EPS = 0.000000001;

type
  TPoint = record
    x,y: Double;
  end;

  TPiece = record
    p1,p2: TPoint;
  end;

var
  tg: array[1..NMAX] of TPiece;
  N: Integer;
  i: Integer;
  p: TPoint;

function  FindIntersect(l1,l2,p1,p2: TPoint; var r: TPoint): boolean;
var
  a1,b1,c1,a2,b2,c2,d1,d2,d: Double;
begin
  a1 := l1.y - l2.y;
  b1 := l2.x - l1.x;
  c1 := -(a1*l1.x+b1*l1.y);
  a2 := p1.y - p2.y;
  b2 := p2.x - p1.x;
  c2 := -(a2*p1.x+b2*p1.y);
  d := a1*b2-a2*b1;
  if abs(d)<EPS then
  begin
    (*прямые параллельны или совпадают*);
    if abs(a1*p1.x+b1*p1.y+c1)>EPS then
    begin
      (*прямые параллельны*)
      FindIntersect := false;
    end else
    begin
      (*прямые совпадают*)
      FindIntersect := true;
      r := p1;
    end;
  end else
  begin
    (*прямые не параллельны*)
     d1 := c2*b1-c1*b2;
     d2 := a2*c1-a1*c2;
     r.x := d1/d;
     r.y := d2/d;
     (*принадлежит ли полученная точка отрезку*)
     if (r.x-p1.x)*(r.x-p2.x)+(r.y-p1.y)*(r.y-p2.y) <= 0
     then
       FindIntersect := true
     else
       FindIntersect := false;
  end;
end;

function CheckP: boolean;
var
  q1,q2,qs1,qs2: TPoint;
  e1,e2: boolean;
  i: Integer;
begin
  i:=1;
  while ((tg[i].p1.x=p.x)and(tg[i].p1.y=p.y))or
        ((tg[i].p2.x=p.x)and(tg[i].p2.y=p.y))
    do inc(i);
  q1 := tg[i].p1;
  q2 := tg[i].p2;
  inc(i);
  while i<=N do
  begin

    if ((tg[i].p1.x=p.x)and(tg[i].p1.y=p.y))or
       ((tg[i].p2.x=p.x)and(tg[i].p2.y=p.y)) then
    begin
      inc(i);
      continue;
    end;

    e1 := FindIntersect(p,tg[i].p1,q1,q2,qs1);
    e2 := FindIntersect(p,tg[i].p2,q1,q2,qs2);
    if e1 and e2 then
    begin
      q1 := qs1;
      q2 := qs2;
    end else
    if not e1 and not e2 then
    begin
      if not FindIntersect(p,q1,tg[i].p1,tg[i].p2,qs1) then
      begin
        CheckP := false;
        exit;
      end;
    end else
    begin
      if e2 then qs1:=tg[i].p2 else qs1:=tg[i].p1;
      e2 := FindIntersect(p,q1,tg[i].p1,tg[i].p2,qs2);
      if not e2 then FindIntersect(p,q2,tg[i].p1,tg[i].p2,qs2);
      q1 := qs1;
      q2 := qs2;
    end;
    inc(i);
  end;
  CheckP := true;
end;

begin

//  assign(input,'input.txt');
  reset(input);
//  assign(output,'output.txt');
  rewrite(output);

  readln(N);
  for i:=1 to N do readln(tg[i].p1.x,tg[i].p1.y,tg[i].p2.x,tg[i].p2.y);

  if N<3 then begin
    writeln('YES');
    exit;
  end;

  for i:=1 to N do
  begin
    p := tg[i].p1;
    if CheckP then
    begin
      writeln('YES');
      exit;
    end;
    p := tg[i].p2;
    if CheckP then
    begin
      writeln('YES');
      exit;
    end;
  end;

  writeln('NO');

end.
