/HIVU - Hình vuông

<Problem>

http://ntucoder.net/Problem/Details/83
              Uses Crt;
        Var  i,j:longint; x,y:array[0..10] of longint;
             distan_1,distan_2,distan_3,distan_4,distan_5,distan_6,distan_7:longint;
             check:boolean;
        Function Di(x,y,x1,y1:longint):longint;
        begin
            Di:=sqr(x-x1)+sqr(y-y1);
        end;
        Begin
            check:=true;
            for i:=1 to 4 do
             begin
                readln(x[i],y[i]);
                for j:=i-1 downto 1 do
                 if (x[i]=x[j]) and (y[i]=y[j]) then check:=false;
             end;
            if check=false then
             begin
                 writeln('NO');
                 exit;
             end;
            distan_1:=Di(x[1],y[1],x[2],y[2]);
            distan_2:=Di(x[1],y[1],x[3],y[3]);
            distan_3:=Di(x[1],y[1],x[4],y[4]);
            if (distan_1=distan_2) then 
             begin
                 distan_4:=Di(x[2],y[2],x[4],y[4]);
                 distan_5:=Di(x[3],y[3],x[4],y[4]);
                 if distan_4=distan_5 then
                  begin
                      (*La Hinh Thoi*)
                      distan_6:=Di(x[1],y[1],x[4],y[4]);
                      distan_7:=Di(x[2],y[2],x[3],y[3]);
                      if distan_6=distan_7 then
                       begin
                           writeln('YES');
                           exit;
                       end;
                  end;
             end
             else
             if (distan_1=distan_3) then 
              begin
                 distan_4:=Di(x[2],y[2],x[3],y[3]);
                 distan_5:=Di(x[4],y[4],x[3],y[3]);
                 if distan_4=distan_5 then
                  begin
                      (*La Hinh Thoi*)
                      distan_6:=Di(x[1],y[1],x[3],y[3]);
                      distan_7:=Di(x[2],y[2],x[4],y[4]);
                      if distan_6=distan_7 then
                       begin
                           writeln('YES');
                           exit;
                       end;
                  end;
             end
             else
             if (distan_2=distan_3) then 
              begin
                 distan_4:=Di(x[3],y[3],x[2],y[2]);
                 distan_5:=Di(x[4],y[4],x[2],y[2]);
                 if distan_4=distan_5 then
                  begin
                      (*La Hinh Thoi*)
                      distan_6:=Di(x[1],y[1],x[2],y[2]);
                      distan_7:=Di(x[3],y[3],x[4],y[4]);
                      if distan_6=distan_7 then
                       begin
                           writeln('YES');
                           exit;
                       end;
                  end;
             end;
             writeln('NO');
        End.