var n,k,sum,sum1:int64;
 a:array[1..6] of longint;
 i,j,h,d:longint;
 begin
   for i:=1 to 6 do
    begin
     read(a[i]);
     sum:=sum+a[i];
    end;
   sum:=sum div 2;
   for i:=1 to 6 do
    begin
     for j:=1 to 6 do
      begin
       for h:=1 to 6 do
        begin
         if (a[i]+a[j]+a[h]=sum) and ((i<>j) and (i<>h) and (j<>h)) then
          begin
            k:=1;
            a[i]:=0;
            a[j]:=0;
            a[h]:=0;
            break;
          end;
          if k=1 then break;
          end;
         if k=1 then break;
        end;
      if k=1 then break;
     end;
for d:=1 to 6 do sum1:=sum1+a[d];
if (sum1=sum) and (k=1) then write('YES')
  else write('NO');
end.

Program eee;
Var s1: string; a: array [1..100000] of integer; j,sum,f,p,k,i: integer;
Begin
  readln(s1);
  f:=1;
  For i:= 1 to 6 do
  begin
   a[i]:=ReadIntegerFromString(s1,f);
   sum:=sum+a[i]
  end;
  For i:= 1 to 4 do
   For j:= i+1 to 5 do
    For p:= j+1 to 6 do
    begin
    if (a[i]+a[j]+a[p])=(sum-(a[i]+a[j]+a[p])) then k:=1;
    end;
  If k=1 then writeln('YES') else writeln('NO');
end.

var a:array[1..6] of integer;
i,i1,osh,sum:longint;
begin
sum:=0;
for i:=1 to 6 do
begin
read(a[i]);
sum:=sum+a[i];
end;
if sum mod 2=1 then osh:=1
else
begin
osh:=1;
for i:=2 to 6 do
begin
for i1:=3 to 6 do
begin
if i<>i1 then
if a[1]+a[i]+a[i1]=sum/2 then
begin
osh:=0;
break;
end;
end;
if osh=0 then break;
end;
end;
if osh=0 then write('Yes') else write('No');
end.

var a1,a2,a3,a4,a5,a6,k:integer;
begin
readln(a1,a2,a3,a4,a5,a6);
if a1+a2+a3=a4+a5+a6 then k:=1;
if a1+a2+a4=a3+a5+a6 then k:=1;
if a1+a2+a5=a4+a3+a6 then k:=1;
if a1+a2+a6=a4+a5+a3 then k:=1;
if a1+a4+a3=a2+a5+a6 then k:=1;
if a1+a5+a3=a4+a2+a6 then k:=1;
if a1+a6+a3=a4+a5+a2 then k:=1;
if a1+a4+a5=a2+a3+a6 then k:=1;
if a1+a4+a6=a3+a5+a2 then k:=1;
if a1+a5+a6=a2+a3+a4 then k:=1;
if k=1 then writeln('YES') else writeln('NO');
end.

Program sad;
var i1,i2,i3,s:integer;
    m:array[1..6] of integer;
label 1;
begin
for i1:=1 to 6 do
begin
read(m[i1]);
s:=s+m[i1];
end;
if s mod 2=1 then begin writeln('NO'); goto 1; end;
for i1:=1 to 4 do
for i2:=i1+1 to 5 do
for i3:=i2+1 to 6 do
if (m[i1]+m[i2]+m[i3])=s div 2 then begin writeln('YES'); goto 1; end;
writeln('NO');
1:
end.

var a:array[1..6] of integer;
sum, i, l, q, pr: integer;
begin
sum:=0;
for i:=1 to 6 do begin read(a[i]);
sum:=sum+a[i];
end;
if sum mod 2=1 then write('NO') else begin
sum:=sum div 2;
pr:=0;
for i:=1 to 4 do begin
for l:=i+1 to 5 do
for q:=l+1 to 6 do
if a[i]+a[l]+a[q]=sum then begin
pr:=1; break; break; break;
end;
end;
if pr=0 then write('NO') else write('YES');
end;
end.

Program AA;
var sum,u,j,a,b,c,i,n:longint;
    s:array[1..100]of longint;

begin
for i:=1 to 6 do
   begin
   read(s[i]);
      sum:=sum+s[i];
   end;

a:=0;
b:=1;
for i:=1 to 4 do
  for j:=i+1 to 5 do
    for u:=j+1 to 6 do
      begin
      if sum-s[i]-s[j]-s[u]=s[i]+s[j]+s[u] then
        a:=1;
      end;

if a=b then
    writeln('YES') else
    writeln('NO');

end.

program asd;

const MAX=6;

var

  a:ARRAY[1..MAX] of integer;
  i,j,k,s,check:integer;

begin
  s:=0;

  readln(a[1],a[2],a[3],a[4],a[5],a[6]);

  for i:=1 to 6 do s:=s+a[i];

  check:=0;

  for i:=1 to MAX do
    begin
      for j:=1 to MAX do
        begin
          for k:=1 to MAX do
            begin
             if ((i<>j) and (i<>k) and (j<>k)) then
                begin
                  if (a[i]+a[j]+a[k] = s-a[i]-a[j]-a[k]) then
                     begin
                       //writeln(i,j,k);
                       check:=1;
                     end;
                end;
            end;
        end;
    end;

   if (check=1) then write('YES')
   else write('NO');

   //readln();
end.

var a:array [1..6] of integer;
b:array[1..216] of integer;
s,i,j,k,n:integer;
begin
s:=0;
for i:=1 to 6 do
begin
read(a[i]);
s:=s+a[i];
end;
n:=1;
for i:=1 to 6 do
for j:=1 to 6 do
for k:=1 to 6 do
begin
if(i<>j) and (j<>k) and (i<>k) then
begin
b[n]:= a[i]+a[j]+a[k];
n:=n+1;
end;
end;
n:=0;
for i:=1 to 120 do
if (s-b[i]=b[i]) then
n:=n+1;
if (n=0) then
write('no') else
write('yes');
end.

var
a: integer;
b: integer;
c: integer;
d: integer;
e: integer;
f: integer;
begin
readln(a,b,c,d,e,f);
if (a+b+c = d+e+f) then println('YES')
else if (a+b+d = c+e+f) then println('YES')
else if (a+b+e = c+d+f) then println('YES')
else if (a+b+f = c+d+e) then println('YES')
else if (a+c+d = b+e+f) then println('YES')
else if (a+c+e = b+d+f) then println('YES')
else if (a+c+f = b+d+e) then println('YES')
else if (a+d+e = b+c+f) then println('YES')
else if (a+d+f = b+c+e) then println('YES')
else if (a+e+f = b+c+d) then println('YES')
else println('NO');
end.

var x1,x2,x3,x4,x5,x6:longint;
begin
 read(x1,x2,x3,x4,x5,x6);
 if x1+x2+x3=x4+x5+x6  then begin write('YES');halt;end;
  if x1+x2+x4=x3+x5+x6  then begin write('YES');halt;end;
  if x1+x2+x5=x4+x3+x6  then begin write('YES');halt;end;
   if x1+x2+x6=x4+x5+x3  then begin write('YES');halt;end;
   if x1+x4+x3=x2+x5+x6  then begin write('YES');halt;end;
    if x1+x5+x3=x4+x2+x6  then begin write('YES');halt;end;
     if x1+x6+x3=x4+x5+x2  then begin write('YES');halt;end;
      if x1+x4+x5=x2+x3+x6  then begin write('YES');halt;end;
       if x1+x4+x6=x2+x5+x3  then begin write('YES');halt;end;
    if x1+x5+x6=x4+x2+x3  then begin write('YES');halt;end;
    write('NO');
  end.

   const eps=0.0000000001;  besk1=200000008;  nn=200000;
   label 1,2;
    type    real=extended;  {string=ansistring;}
    mas=array [-100..nn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[0..nn] of int64;mass1=^mass;
    var p,tt,time,y,z,pmax,imax,p1,p2,p3,p4,t,l,ot,nm,n,s1,s2,m,s,smin,cen,dl,t2,i1,besk:int64;
    mask,step, k,ii,i,j:longint;
     aa,bb,cc:double;
     x,aold,b,a:array[-10..2000000] of int64;
     dda:array[-10..1200,-10..1200] of int64;
   zanx,zany:array[-10..2000000] of boolean;
    sss, ss1,ss2:string;
     fl:array[0..200000] of boolean;
    ss:string;ch:char;
    pole :array [-10..2000,-10..2000] of char;
    maxpr:array[0..nn] of string;
    st2:array[0..nn] of string;
     v0,v1,s0,t0:real;
     zv:point;
     newx,newy,xx,yy:array[-1..200000] of int64;

     yot:double;
       flag,flag1:boolean;
    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p/pi*180;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

begin
   { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
    }
   n:=6;
  for i:=1 to n do read(a[i]);

  ot:=0; for i:=1 to n do ot:=ot+a[i];

  for mask:=0 to 63 do
    begin
      p:=mask;
      tt:=0; t:=0;
      for i:=1 to 6 do begin
      x[i]:=p and 1; p:=p shr 1; end;
      for i:=1 to 6 do t:=t+x[i];
      for i:=1 to 6 do tt:=tt+a[i]*x[i];

    {  writeln('mask= ',mask,' tt= ',tt);
    }  if (tt=ot-tt)and(t=3) then begin writeln('YES'); goto 1;  end;

    end;

    writeln('NO');

   1:          close(output);
end.

program  mqwerty;
var mass: array [1..6] of longint;
i,j,kol,sum:longint;
procedure swap(var a,b:longint);
var t: longint;
begin
  t:=a;
  a:=b;
  b:=t;
end;

begin
  for i:=1 to 6 do begin
    read(mass[i]);
    sum:=sum+mass[i];
  end;
  if sum mod 2 =1 then writeln('NO') else
  begin
  kol:=0;

  for i:=0 to 215 do
    begin
      if (mass[(i mod 6)+1]+mass[((i div 6) mod 6)+1]+ mass[(i div 36)+1]=sum div 2
      )
        and ((i mod 6)+1<>((i div 6) mod 6)+1)
        and (((i div 6) mod 6)+1<>(i div 36)+1)
        and ((i div 36)+1<>(i mod 6)+1)then
      inc(kol);
    end;
  if kol>0 then writeln('YES') else writeln('NO');
  end;
end.

var a:array[1..6] of integer; s,i,j,k:integer;
   begin
   s:=0;
   for i:=1 to 6 do begin read(a[i]); s:=s+a[i]; end;
   if s mod 2 = 1 then begin writeln('NO'); exit; end;
   for i:=1 to 4 do
   for j:=i to 5 do
   for k:=j+1 to 6 do
      if (i<>j) and (j<>k) and (k<>i) then if a[i]+a[j]+a[k]=s div 2 then begin writeln('YES'); exit; end;
  writeln('NO');
   end.

var

  i, j, k: integer;
  sum: longint;
  x: boolean;
  a: array[1..6] of longint;

begin

  for i := 1 to 6 do
  begin
    read(a[i]);
    sum := sum + a[i];
  end;
  for i := 1 to 6 do
    for j := i + 1 to 6 do
      for k := j + 1 to 6 do
      begin
        if a[i] + a[j] + a[k] = sum - (a[i] + a[j] + a[k]) then
          x := true;
      end;

  if x = true then
    writeln('YES')
  else
    writeln('NO');

end.

var a,b,c,a1,b1,c1:longint;
begin
read(a,b,c,a1,b1,c1);
if (a+b+c=a1+b1+c1) or (a+b+a1=c+b1+c1) or (a+b+c1=c+a1+b1)or
(a+b+b1=c+a1+c1) or (a+c+a1=b+c1+b1) or (a+c+b1=b+c1+a1) or
(a+c+c1=b+a1+b1) or (a+b1+c1=b+c+a1) or (a+a1+c1=b+c+b1) or
(a+a1+b1=b+c+c1) then
writeln('YES')
else
writeln('NO');
end.                  {}

var
i,s,h,j,f:integer;
a:array[1..6] of integer;
begin
s:=0;
f:=0;
for i:=1 to 6 do begin
read(a[i]);
s:=s+a[i];
end;
if (s mod 2)=0 then s:=s div 2 else begin write('NO');
exit end;
for i:=1 to 3 do
for j:=i+1 to 5 do
for h:=j+1 to 6 do
if a[i]+a[j]+a[h]=s then f:=1;
if f=1 then begin write('YES');
exit end;
if f=0 then write('NO');
end.

var
i,j,k,sum:integer;
a:array [1..6] of integer;
log:boolean;
begin
read (a[1]);
read (a[2]);
read (a[3]);
read (a[4]);
read (a[5]);
read (a[6]);
sum:=a[1]+a[2]+a[3]+a[4]+a[5]+a[6];
for i:=1 to 6 do
begin
if log=true then break;
  for j:=1 to 6 do
  begin
if log=true then break;
    for k:=1 to 6 do
      if (i<>j) and (j<>k) and (i<>k) then if a[i]+a[j]+a[k]=sum/2 then log:=true;
end;
end;
if log=FALSE then write('NO') else write('YES');
end.

const n=6;
var a:array[1..n] of integer;
    i,s,j,m:integer;
    f:boolean;
Begin
  f:=true;
  for i:=1 to n do begin
    read(a[i]);
    s:=s+a[i];
  end;
  for i:=1 to n do if a[i]>s-a[i] then f:=false;

  if (s mod 2=0) and (f=true) then begin
    f:=false;
    for i:=1 to n-2 do begin
      for j:=i+1 to n-1 do begin
        for m:=j+1 to n do begin
          if a[i]+a[j]+a[m]=s div 2 then f:=true;
        end;
      end;
    end;
  end
   else f:=false;
  if f=false then writeln('NO') else writeln('YES');
End.

var a:array[1..100]of integer;i,j,l,s,t:integer;
begin
for i:=1 to 6 do
begin
read(a[i]);
s+=a[i];
end;
for i:=1 to 4 do
for j:=i+1 to 5 do
for l:=j+1 to 6 do
if (a[i]+a[j]+a[l])*2=s then t:=1;
if t=1 then writeln('YES') else writeln('NO');
end.

var a:array[1..6]of integer;
    i,i1,i2,i3,i4,i5,i6:integer;
    f:boolean;
begin
f:=false;
for i:=1 to 6 do read(a[i]);
for i1:=1 to 6 do
for i2:=1 to 6 do
if i1<>i2 then
for i3:=1 to 6 do
if (i3<>i2)and(i3<>i1) then
for i4:=1 to 6 do
if (i4<>i3)and(i4<>i2)and(i4<>i1)then
for i5:=1 to 6 do
if (i5<>i4)and(i5<>i3)and(i5<>i2)and(i5<>i1)then
for i6:=1 to 6 do
if (i6<>i5)and(i6<>i4)and(i6<>i3)and(i6<>i2)and(i6<>i1)then
if ((a[i1]+a[i2]+a[i3]-a[i4]-a[i5]-a[i6])=0)then f:=true;
if f then write('YES')else write('NO');
end.

program AAA;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Math;

var
  a, b, c, d, e, f: integer;
begin
  readln(a, b, c, d, e, f);
  if(a + b + c = d + e + f) or (a + e + c = d + b + f) or (a + d + c = b + e + f)
    or (a + f + c = d + e + b) or (d + b + c = a + e + f) or (e + b + c = d + a + f)
      or (f + b + c = d + e + a) or (a + b + d = c + e + f) or (a + b + e = d + c + f)
        or (a + b + f = d + e + c) then writeln('YES')
  else writeln('NO');
end.

program ad1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  i, j, k, sum: integer;
  cnt: array[0..7] of integer;
  check: boolean;

begin
  sum := 0;
  for i := 1 to 6 do begin
    read(cnt[i]);
    inc(sum, cnt[i]);
  end;

  check := false;

  for i := 1 to 4 do
    for j := i + 1 to 5 do
      for k := j + 1 to 6 do
        if (cnt[i] + cnt[j] + cnt[k] = sum div 2) then
          check := true;

  if (sum mod 2 = 1) then
    check := false;

  if (check) then
    writeln('YES')
  else
    writeln('NO');
  readln; readln;
end.

type mass=array[1..6]of integer;
var m:mass;
  t:text;
  i,j,k:integer;
  s1,s2:longint;
  f:boolean;
function prov(i,j,k:integer):boolean;
var m1:mass;
   ii:integer;
begin
  m1:=m;
  s1:=m[i]+m[j]+m[k];
  m1[i]:=0;
  m1[j]:=0;
  m1[k]:=0;
  s2:=0;
  for ii:=1 to 6 do
   s2:=s2+m1[ii];
  prov:=s1=s2
end;
begin
{  assign(t,'input.txt');
  reset(t);}
    for i:=1 to 6 do
     read(m[i]);
{  close(T); }
  f:=false;
  for i:=1 to 6 do
   for j:=i+1 to 6 do
    for k:=j+1 to 6 do
     if prov(i,j,k)
     then begin
            f:=true;
            break
          end;
  if f
  then writeln('YES')
  else writeln('NO')
end.

program project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, math;

var
  i, j, sum, k: integer;
  a: array [1..6] of integer;
  z: boolean = false;

begin
  sum := 0;
  for i := 1 to 6 do begin
    read(a[i]);
    inc(sum, a[i]);
  end;
  for i := 1 to 6 do
    for j := 1 to 6 do
      for k := 1 to 6 do begin
        if (i <> j) and (j <> k) and (i <> k)  then begin
          if ((a[i] + a[j] + a[k]) * 2 = sum) then
            z := true;
        end;
      end;
  if (z) then
    writeln('YES')
  else
    writeln('NO');
  readln;
  readln;
end.

program firsttt;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  i, j, sum, k: integer;
  a: array[1..6] of integer;

begin
  sum := 0;
  for i := 1 to 6 do begin
    read(a[i]);
    inc(sum, a[i]);
  end;

  for i := 1 to 6 do begin
    for j := i + 1 to 6 do
      for k := j + 1 to 6 do
        if (a[i] + a[j] + a[k] = sum - (a[i] + a[j] + a[k])) then begin
          writeln('YES');
          halt(0);
        end;
  end;
  writeln('NO');
end.

program zadachaCCCCC;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  i, j, q, w, e, k, s: Integer;
  a: array[1..10] of integer;

begin
  s := 0;
  for i := 1 to 6 do
    read(a[i]);
  for i := 1 to 6 do
    for j := i + 1 to 6 do
      for k := j + 1 to 6 do
      begin
        for q := 1 to 6 do
          if (q <> i) and (q <> j) and (q <> k) then
            s := s + a[q];
        if (a[i] + a[j] + a[k] = s) then
        begin
          Writeln('YES');
          Exit;
        end;
        s := 0;
      end;
  Writeln('NO');
  readln;
  readln;
end.

var m:array[1..6] of integer; i,j,h,s:integer; a:boolean;
begin
s:=0; a:=false;
 for i:=1 to 6 do
  begin
    read(m[i]); s:=s+m[i]
  end;
if s mod 2 = 1 then writeln('NO') else
  begin
     for i:=1 to 4 do
     for j:=i+1 to 5 do
     for h:=j+1 to 6 do
     if m[i]+m[j]+m[h] = s div 2 then a:=true;

  if a = true then writeln('YES') else writeln('NO')
  end;

end.

var a:array[1..6] of longint;
    f:text;
    i,j,k,dem,n,s,dau:longint;
begin
      //assign(f,'eralto.inp');reset(f);
      for i:=1 to 6 do begin read(a[i]);s:=s+a[i]; end;
      for i:=1 to 6 do
         for j:=1 to 6 do
            for k:=1 to 6 do
         if (i<>j) and (j<>k) and (k<>i) and (a[i]+a[j]+a[k]=s div 2) and (s mod 2=0) then
            begin
                 dau:=1;
                 break;
            end;
     if dau=1 then write('YES') else write('NO');
   // close(f);
    // readln
end.

var a:array[1..10] of longint;
    i,k,j,s:Longint;
begin
 for i:=1 to 6 do
  read(a[i]);
 for i:=1 to 6 do
  s:=s+a[i];

 if s mod 2=1
 then begin
  writeln('NO');
  exit;
 end;
 for i:=1 to 4 do
  for k:=i+1 to 5 do
   for j:=k+1 to 6 do
    if (a[i]+a[k]+a[j])=s div 2
    then begin
     writeln('YES');
     exit;
    end;
 writeln('NO');
end.

var a,b,c,d,e,f:integer;
begin
        read(a,b,c,d,e,f);
        if ((a+b+c=d+e+f)or(a+b+d=c+e+f)or(a+b+e=c+d+f)or(a+b+f=c+d+e)or(a+c+d=b+e+f)or(a+c+e=b+d+f)or(a+c+f=b+e+d)or(a+d+e=b+c+f)or(a+d+f=b+c+e)or(a+e+f=b+c+d)) then
                writeln('YES')
        else writeln('NO');
end.

var
  s1, s2, i, k, j, z: integer;
  a: array[1..6] of integer;

begin
  s1 := 0;
  s2 := 0;
  for i := 1 to 6 do
  begin
    read(a[i]);
    s1 := s1 + a[i];
  end;
  if s1 mod 2 = 1 then writeln('NO') else begin
    for i := 1 to 4 do
      for k := i + 1 to 5 do
        for j := k + 1 to 6 do
        begin
          for z := 1 to 6 do
            if (z <> i) and (z <> k) and (z <> j) then s2 := s2 + a[z];
          if (s2 = s1 div 2) and (a[i] + a[k] + a[j] = s1 div 2) then begin writeln('YES'); exit; end;
          s2:=0;
        end;
    writeln('NO');
  end;
end.

var a:array[1..6] of integer; i,j,k,l,m,n,a1,k1,n1,j1:integer;
begin
n1:=0;
j1:=0;
k1:=0;
l:=0;
for i:=1 to 6 do
begin
read(a1);
a[i]:=a1;
l:=l+a1;
end;
m:=0;
if l mod 2=0 then
begin
for j:=1 to 6 do
for k:=1 to 6 do
for n:=1 to 6 do
for j1:=1 to 6 do
for k1:=1 to 6 do
for n1:=1 to 6 do
begin
if m>0 then
break
else
if (a[j]+a[k]+a[n]= a[j1]+a[k1]+a[n1]) and (j<>k) and (n<>k) and (j1<>k) and (k1<>k) and (n1<>k) and (n<>j) and (j1<>j) and (k1<>j) and (n1<>j)   and (j1<>n) and (k1<>n) and (n1<>n) and (n1<>j1) and (n1<>k1) and (k1<>j1)   then
begin
inc(m);
break;
end;
end;
if m=1 then
writeln('YES');
if m<1 then
writeln('NO')
end
else
writeln('no');
end.

var
  a: array[1..6]of integer;
  i, s, n, j, z: integer;
  fl: boolean;

begin
  n := 6;
  for i := 1 to n do
  begin
    read(a[i]);
    s := s + a[i];
  end;
  fl := false;
  if s mod 2 = 0 then
  begin
    for i := 1 to n do
      for j := i + 1 to n do
        for z := j + 1 to n do
          if a[i] + a[j] + a[z] = s div 2 then
          begin
            fl := true;
            break;
          end;
  end;
  if fl then writeLn('yes')
  else writeLn('no');
end.

var
a:array [1..7] of integer;
i:integer;
begin
for i:=1 to 6 do
read(a[i]);
if (a[1]+a[2]+a[3]=a[4]+a[5]+a[6]) then begin
writeln('YES');
exit;
end
else
begin
if (a[1]+a[2]+a[4]=a[3]+a[5]+a[6]) then begin
writeln('YES');
exit;
end
else
begin
if (a[1]+a[2]+a[5]=a[3]+a[4]+a[6]) then begin
writeln('YES');
exit;
end
else
begin
if (a[1]+a[2]+a[6]=a[3]+a[4]+a[5]) then begin
writeln('YES');
exit;
end
else
begin
if (a[1]+a[3]+a[4]=a[2]+a[5]+a[6]) then begin
writeln('YES');
exit;
end
else
begin
if (a[1]+a[3]+a[5]=a[2]+a[4]+a[6]) then begin
writeln('YES');
exit;
end
else
begin
if (a[1]+a[3]+a[6]=a[2]+a[4]+a[5]) then begin
writeln('YES');
exit;
end
else
begin
if (a[1]+a[4]+a[5]=a[2]+a[3]+a[6]) then begin
writeln('YES');
exit;
end
else
begin
if (a[1]+a[4]+a[6]=a[2]+a[3]+a[5]) then begin
writeln('YES');
exit;
end
else
begin
if (a[1]+a[5]+a[6]=a[2]+a[3]+a[4]) then begin
writeln('YES');
exit;
end
else writeln('NO');
end;
end;
end;
end;
end;
end;
end;
end;
end;
end.

var A, B: array[1..6] of integer;
    i, j, sum, select, num: integer;
    ans: string;

procedure binary(n: integer);
var i, du: integer;
begin
  i:=6; du:=0;
  while n<>0 do
    begin
      du:=n mod 2;
      n:=n div 2;
      B[i]:=du; dec(i);
    end;
end;

begin
  for i:=1 to 6 do
    begin
      read(A[i]);
      sum:=sum+A[i];
    end;
  readln; ans:='NO';
  for i:=0 to 63 do
    begin
      binary(i); select:=0; num:=0;
      for j:=1 to 6 do
        if B[j]=1 then
          begin
            select:=select+A[j];
            inc(num);
          end;
      if ((2*select=sum) and (num=3)) then
        begin
          ans:='YES';
          break;
        end;
    end;
  write(ans);
end.

var
sum, sum2,sum3,i:integer;
a: array [1..6] of integer;
begin
for i:=1 to 6 do
  begin
  read(a[i]);
  sum:=sum+a[i];
  end;
if sum mod 2=1 then writeln('NO')
else
  begin
  sum2:=sum div 2-a[1];
  sum3:=sum2-a[2];
  if ((sum3=a[3]) or (sum3=a[4]) or (sum3=a[5]) or (sum3=a[6])) then writeln('YES')
  else
    begin
    sum3:=sum2-a[3];
    if ((sum3=a[4]) or (sum3=a[5]) or (sum3=a[6])) then writeln('YES')
    else
      begin
      sum3:=sum2-a[4];
      if ((sum3=a[5]) or (sum3=a[6]) or (sum2=a[5]+a[6])) then writeln('YES')
      else writeln('NO');
      end;
    end;
  end;
end.

program Ann;
label l1;
var n,m,i,j,b,c,k:integer;
a:array[1..6]of integer;
begin
for i:=1 to 6 do
    read(a[i]);
if((a[1] + a[2] + a[3] + a[4] + a[5] + a[6]) mod 2 = 0)then
        m:=(a[1] + a[2]+a[3] + a[4] + a[5] + a[6]) div 2
else
    begin
    writeln('NO');
    goto l1;
    end;
c:=0;
for i:=1 to 6 do
    begin
    if(c = 1)then
    break;
    for j:=1 to 6 do
        begin
        if(c = 1)then
        break;
        for k:=1 to 6 do
            begin
            if(i <> j)and(j <>  k)and(k <> i)then
            if(a[i] + a[j] + a[k] = m)then
                    begin
                    c:=1;
                    break;
                    end;
            end;
        end;
    end;
if(c = 0)then
     writeln('NO')
else
    writeln('YES');
l1:
end.

var
        i, j, k, l, t, h : integer;
        a : array [ 1..6 ] of integer;
begin
  for i := 1 to 6 do
        read( a[ i ] );
  for i := 1 to 6 do
    for j := 1 to 6 do
      if ( i <> j )
        then
          for k := 1 to 6 do
            if ( k <> i ) and ( k <> j )
              then
                for l := 1 to 6 do
                  if ( l <> i ) and ( l <> j ) and (  l <> k )
                    then
                      for t := 1 to 6 do
                        if ( t <> i ) and ( t <> j ) and ( t <> k ) and ( t <> l )
                          then
                            for h  := 1 to 6 do
                              if ( h <> i ) and ( h <> j ) and ( h <> k ) and ( h <> l ) and ( h <> t )
                                then
                                  if ( a[ i ] + a[ j ] + a[ k ] = a[ l ] + a[ t ] + a[ h ] )
                                        then
                                          begin
                                            writeln( 'YES' );
                                            halt;
                                          end;
  writeln( 'NO' );
end.

const fin='';
        fout='';
var f,g:Text;
        i,j,k,qa:longint;
        a:array[1..8] of longint;
procedure xl;
begin
        for i:=1 to 4 do
                for j:=i+1 to 5  do
                        for k:=j+1 to 6 do
                                if a[i]+a[j]+a[k]=qa-(a[i]+a[j]+a[k])then
                                begin
                                        write(g,'YES');
                                        exit;
                                end;
        write(g,'NO');
end;
begin
        assign(f,fin);reset(f);
        assign(g,fout);rewrite(g);
        qa:=0;
        for i:=1 to 6 do
        begin
                read(f,a[i]);
                qa:=qa+a[i];
        end;
        xl;
        close(f);
        close(g);

end.

var a:array[1..10] of longint;
    i,k,j,s:Longint;
begin
 for i:=1 to 6 do begin
  read(a[i]);
  s:=s+a[i];
  end;
 if s mod 2=1
 then begin
  writeln('NO');
  exit;
 end;
 for i:=1 to 4 do
  for k:=i+1 to 5 do
   for j:=k+1 to 6 do
    if (a[i]+a[k]+a[j])=s div 2
    then begin
     writeln('YES');
     exit;
    end;
 writeln('NO');
end.

{$MACRO ON}
{$MODE OBJFPC}
{$COPERATORS ON}
{$DEFINE wait:=readln;readln;}
{$DEFINE maxN:=trunc(1e5)+1}

uses gvector,garrayutils,math;
const	fi='';
		fo='';
type
	TType = int32;   //   <------ TYPE
	vector = specialize TVector<TType>;
    compare = class
    	public
        	class function c(a,b : TType) : boolean;
    end;
    utils = specialize TOrderingArrayUtils<vector,TType,compare>;
class function compare.c(a,b : TType) : boolean;
	begin Result := a<b; end;     //   <------ ORDER

var sum : int32;
	a : array[1..6] of int32;

procedure readData();
	var i : int32;
    begin
		for i := 1 to 6 do begin
            read(a[i]);
			sum += a[i];
		end;
    end;

procedure main();
    var i,j,k,tmp : int32;
	begin
        readData();
        for i := 1 to 4 do begin
            for j := i+1 to 5 do begin
            	for k := j+1 to 6 do begin
                    tmp := a[i]+a[j]+a[k];
					if (tmp = sum-tmp) then begin
                        writeln('YES');
						halt;
					end;
				end;
			end;
		end;
		writeln('NO');
    end;

begin
    assign(input,fi); reset(input);
    assign(output,fo); rewrite(output);
	main();
    close(input); close(output);
end.

Const
	fi='';
	fo='';

Var	f:text;
	sum:real;
	a:array [1..6] of longint;

Procedure NhapDL;
var	i:word;
begin
	sum:=0;
	assign(f,fi); Reset(f);
	For i:= 1 to 6 do
	begin
		read(f,a[i]);
		sum:=sum+a[i];
        end;
	Close(f);
end;

Procedure Xuly;
var	x,y,z,tmp:longint;
begin
	assign(f,fo); Rewrite(F);
	For x:= 1 to 4 do
	For y:= x+ 1 to 5 do
	For z:= y+1 to 6 do
		if a[x] +a[y] +a[z] = (sum/ 2) then
		begin
			Writeln(f,'YES');
			Close(f);
			Exit;
		end;
	WRite(f,'NO');
	Close(f);
end;

Begin
	NhapDL;
	Xuly;
end.

//fpc 3.0.0

var sum,i:integer;
a:array[1..6] of integer;
ans:boolean;

procedure rec(inteam,pl,ssum:integer);
begin

//writeln(inteam,' ',pl,' ',ssum);

if inteam=3 then begin

if ssum=(sum div 2) then ans:=true;

end else begin

if pl<=6 then begin

rec(inteam+1,pl+1,ssum+a[pl]);
rec(inteam,pl+1,ssum);

end;

end;

end;

begin
    for i:=1 to 6 do read(a[i]);

    sum:=0;
    for i:=1 to 6 do sum:=sum+a[i];

    ans:=false;

    if (sum mod 2)=0 then
    rec(0,1,0);

    if ans then writeln('YES') else writeln('NO');
end.

var a,b:array[0..10] of longint;
    sl,x,y,i:longint;

procedure vet(i:longint);
    var j,sl:longint;
        begin
            if i=7 then
                begin
                    sl:=0;
                    for j:=1 to 6 do
                        if b[j]=1 then inc(sl);
                    if sl=3 then
                        if x=y then
                            begin
                                writeln('YES');
                                halt;
                            end;
                    exit;
                end;
            for j:=0 to 1 do
                begin
                    x:=x+a[i]*j;
                    y:=y+a[i]*((j+1) mod 2);
                    b[i]:=j;
                    vet(i+1);
                    x:=x-a[i]*j;
                    y:=y-a[i]*((j+1) mod 2);
                end;
        end;
begin
for i:=1 to 6 do
    read(a[i]);
vet(1);
writeln('NO');
end.

program kubok1;
var x:boolean; AllTeam:word; a:array[1..6] of word;
begin
    x:=false;
    AllTeam:=0;
	  for var i:=1 to 6 do begin Read(a[i]); AllTeam:=AllTeam+a[i]; end;

  	if ((AllTeam mod 2)=0)
	  then
        for var j1:=1 to 4 do
            for var j2:=j1+1 to 5 do
                for var j3:=j2+1 to 6 do
                    begin
                        if ((a[j1]+a[j2]+a[j3])*2=AllTeam) and (x<>True)
                        then  x:=True;
                    end;
	  if x then write('YES') else write('NO');
end.

var a:array[1..6] of integer;
b,i,j,n:integer;
begin
n:=0;
for i:=1 to 6 do begin
read(a[i]);
b:=b+a[i];end;
if (b mod 2<>0) then begin write('NO');exit;end
else b:=(b div 2)-a[1];
for i:=2 to 6 do
for j:=3 to 6 do
if (i<>j) and (a[i]+a[j]=b) and (n=0) then begin write('YES');n:=1;break;end;
if n=0 then write('NO');
end.

var a:array[1..6] of integer;
    i,n : integer;
    l : boolean;
begin
  n:=6;
  l:=false;
  for i:=1 to n do
    read(a[i]);
  for i:=1 to 10 do
            if a[1]+a[2]+a[3]=a[4]+a[5]+a[6] then l:=true
       else if a[1]+a[2]+a[4]=a[3]+a[5]+a[6] then l:=true
       else if a[1]+a[2]+a[5]=a[4]+a[3]+a[6] then l:=true
       else if a[1]+a[2]+a[6]=a[4]+a[5]+a[3] then l:=true
       else if a[1]+a[3]+a[4]=a[2]+a[5]+a[6] then l:=true
       else if a[1]+a[3]+a[5]=a[4]+a[2]+a[6] then l:=true
       else if a[1]+a[3]+a[6]=a[4]+a[2]+a[5] then l:=true
       else if a[1]+a[4]+a[5]=a[2]+a[6]+a[3] then l:=true
       else if a[1]+a[4]+a[6]=a[2]+a[3]+a[5] then l:=true
       else if a[1]+a[5]+a[6]=a[2]+a[3]+a[4] then l:=true;
  if l then writeln('YES')
       else writeln('NO');
end.

var
a,b,c,d,f,e,m,s:integer;
Begin
readln(a,b,c,d,e,f);

S:=(a+b+c+d+f+e);
m:=s div 2;
  if ( s mod 2 <>0) THEN WRITELN('no')
        else if (a+b+c=m) then WRITELN('YES')
        else if (a+c+d=m) then WRITELN('YES')
        else if (a+f+d=m) then WRITELN('YES')
        else if (a+f+e=m) then WRITELN('YES')
                else if (a+b+d=m) then WRITELN('YES')
                else if (a+c+f=m) then WRITELN('YES')
                else if (a+d+e=m) then WRITELN('YES')
                else if (a+b+f=m) then WRITELN('YES')
                 else if (a+b+e=m) then WRITELN('YES')
                else if (a+c+f=m) then WRITELN('YES')

        else if (b+c+d=m) then WRITELN('YES')
        else if (b+d+f=m) then WRITELN('YES')
        else if (b+f+e=m) then WRITELN('YES')
         else if (b+c+f=m) then WRITELN('YES')
         else if (b+d+e=m) then WRITELN('YES')

        else if (c+d+f=m) then WRITELN('YES')
        else if (c+f+e=m) then WRITELN('YES')
         else if (c+d+e=m) then WRITELN('YES')

        else if (d+f+e=m) then WRITELN('YES')

        else if (c+f+e=m) then WRITELN('YES')
        else writeln('NO')
  end.

var
    i,j,F,K,D:longint; a,P,R:array[0..6] of integer;
begin
     for i:=1 to 6 do read(a[i]);
     FOR I:=0 TO 6 DO
  P[I]:=I;
  WHILE P[0]=0 DO
   BEGIN
     FOR I:=1 TO 6 DO
       IF (A[P[1]]+A[P[2]]+A[P[3]])=(A[P[4]]+A[P[5]]+A[P[6]]) THEN F:=1;
  J:=6;
  WHILE P[J-1] > P[J] DO
    J:=J-1;
  K:=6;
  WHILE P[J-1] > P[K] DO
    K:=K-1;
  D:=P[J-1];
  P[J-1]:=P[K];
  P[K]:=D;
  FOR I:=J TO 6 DO
    R[I]:=P[6-(I-J)];
  FOR I:=J TO 6 DO
    P[I]:=R[I];
    END;
  IF F=1 THEN WRITELN('YES') ELSE WRITELN('NO');
END.

program pr1;
var s,G,B,K,i:integer;A:ARRAY[1..100000] OF INTEGER;
begin
  s:=0;B:=0;
  for i:=1 to 6 do begin
    read(a[i]);
    s:=s+a[i];
  end;
  if (s mod 2 =0) then begin
    for i:=1 to 6 do begin
      for g:=1 to 6 do begin
        for k:=1 to 6 do begin
          if (a[i]+a[g]+a[k]=(s div 2)) and (k<>i) and (k<>g) and (g<>i) then b:=1;
        end;
      end;
    end;
  end;
  if B=1 then writeln('YES')
  ELSE WRITELN('NO');
end.

var a,b,c,d,e,f:integer;

begin

  readln(a,b,c,d,e,f);
  if a+b+c=d+e+f then
    writeln('YES')
  else
    if a+b+d=c+e+f then
      writeln('YES')
      else
        if a+b+e=c+d+f then
          writeln('YES')
           else
              if a+b+f=c+e+d then
                writeln('YES')
                 else
    if a+d+c=b+e+f then
    writeln('YES')
  else
  if a+e+c=b+d+f then
    writeln('YES')
  else
  if a+f+c=b+d+e then
    writeln('YES')
  else
  if d+b+c=a+e+f then
    writeln('YES')
  else
  if e+b+c=a+d+f then
    writeln('YES')
  else
  if f+b+c=d+e+a then
    writeln('YES')
  else
 writeln('NO')
end.

program qq;
var i,j,k,t:integer;
q,d:real;
a:array[1..6]of real;
begin
for i:=1 to 6 do
begin
read(a[i]);
q:=q+a[i];
end;
q:=q/2;
for i:=1 to 4 do
for j:=i+1 to 5 do
for k:=j+1 to 6 do
begin
d:=a[i]+a[j]+a[k];
if d=q then
t:=t+1;
end;
if t=0 then writeln('No') else writeln('Yes');;
end.

program ya;
var x,y,z,s,i,j,k,l,m,n:longint;
    f:array[0..6] of longint;
begin
  for i:=1 to 6 do
    begin
      read(f[i]);
      inc(f[0],f[i]);
    end;
  if odd(f[0]) then
    begin
      writeln('NO');
      exit;
    end;
  for i:=1 to 4 do
    for j:=i+1 to 5 do
      for k:=j+1 to 6 do
        if f[i]+f[j]+f[k]=f[0] div 2 then
          begin
            writeln('YES');
            exit;
          end;
  writeln('NO');
end.

var a, b, c, d, e, f, g, k, z: integer;
q: array[1..6] of integer;
begin
for a:= 1 to 6 do
begin
read(q[a]);
end;

for b:= 1 to 6 do
begin
  for c:= 1 to 6 do
  begin
  if (c <> b) then
  begin
    for d:= 1 to 6 do
    begin
    if (c <> d) and (d <> b) then
     for e:= 1 to 6 do
     if (e <> b) and (e <> c) and (e <> d) and (e <> f) and (e <> g) then
      for f:= 1 to 6 do
      if (f <> b) and (f <> c) and (f <> d) and (f <> e) and (f <> g) then
        for g:= 1 to 6 do
        if (g <> b) and (g <> c) and (g <> d) and (g <> f) and (g <> e) then
        if (q[b] + q[c] + q[d] = q[e] + q[f] + q[g]) and (k <> 1) then
        begin
        write('Yes');
        k:= 1;
        end;
        {else
        begin
        if (k <> 1) and (z <> 1) then
        begin
        write('No');
        z:= 1;
        end;}
    end;
  end;
end;
end;
if (k <> 1) then
write('No');
end.

var
j,c,n,i,sum,sum1:longint;
a:array[-100..10000]of longint;
bol:boolean;
begin
n:=6;
for i:=1 to n do begin
    read(a[i]);
    sum:=sum+a[i];
end;
for i:=1 to n-2 do begin
    for j:=i+1 to n-1 do begin
               for c:=j+1 to n do begin
                   if (i<>j)and(j<>c)and(i<>c) then begin
                       sum1:=a[i]+a[j]+a[c];
                       if sum-sum1=sum1 then bol:=true;
                   end;
               end;
    end;
end;
if bol then writeln('YES')
else
writeln('NO');
end.

program cf886a;
uses math;
var A: array[1..6] of Int64;
    sum, i, j, k: integer;
begin
    for i := 1 to 6 do Read(A[i]);
    sum := sumInt(A);
    if (sum mod 2 <> 0) then WriteLn('NO')
    else
    begin
        sum := sum div 2;
        for i := 1 to 6 do
        begin
            for j := i + 1 to 6 do
            begin
                for k := j + 1 to 6 do
                begin
                    if (A[i] + A[j] + A[k]) = sum then
                    begin
                        WriteLn('YES');
                        exit;
                    end;
                end;
            end;
        end;
        WriteLn('NO');
    end;
    exit;
end.

var a:array [1..6] of integer;
var i,x,y,z,k,n:integer;
begin

  for i:=1 to 6 do begin
    read(a[i]);
    n:=n+a[i];
  end;

  for x:=1 to 6 do begin
    for y:=1 to 6 do begin
      for z:=1 to 6 do begin
        if ((x<>y) and(x<>z) and (y<>z) and (2*(a[x]+a[y]+ a[z])=n)) then
          k:=1;
      end;
    end;
  end;

  if k=1 then
    writeln('YES')
  else
    writeln('NO');
end.

Var
    Sum: Int64;
    a: Array [1..6] of Int64;

Begin
    For Var i := 1 to 6 do Begin
        Read(a[i]);
        Sum += a[i]
    End;
    If Sum mod 2 = 0 then Begin
        For Var i := 1 to 4 do
            For Var j := i + 1 to 5 do
                For Var k := j + 1 to 6 do
                    If a[i] + a[j] + a[k] = Sum div 2 then Begin
                        Write('YES');
                        Exit
                    End;
        Write('NO')
    End
    Else
        Write('NO')
End.

var x,i,j,k,n,s,p:integer;
a:array[1..6]of integer;
f:boolean;
begin
f:=false;
for i:=1 to 6 do begin
read(x);
a[i]:=x;
s:=s+x;
end;
for i:=1 to 4 do
for j:=i+1 to 5 do
for p:=j+1 to 6 do
if (a[i]+a[j]+a[p]=s/2) then
begin writeln('YES'); exit; end;
writeln('NO');
end.

program aaa;
var a: array [1..6] of integer;
    i,j,l,k,s: integer;
begin
  s:=0;
  for i:=1 to 6 do
    begin
      read(a[i]);
      s:=s+a[i];
    end;
  if s mod 2<>0 then writeln('no')
  else
    begin
      k:=0;
      for i:=1 to 6 do
        for j:=1 to 6 do
          for l:=1 to 6 do
            if (i<>j) and (j<>l) and (l<>i) then
              if a[i]+a[j]+a[l]=s div 2 then k:=1;
    end;
  if k=1 then writeln('yes')
  else writeln('no');
end.

var a1,a2,a3,a4,a5,a6:integer;
begin
read(a1,a2,a3,a4,a5,a6);
 if (a1>=0) and (a1<=1000) and (a2>=0) and (a2<=1000) and (a3>=0) and (a3<=1000) and (a4>=0) and (a4<=1000) and (a5>=0) and (a5<=1000) and (a6>=0) and (a6<=1000) then
 begin
  if (a1+a2+a3=a4+a5+a6) then writeln('YES')
 else
  if (a4+a2+a3=a1+a5+a6) then writeln('YES')
 else
  if (a1+a5+a3=a4+a2+a6) then writeln('YES')
 else
  if (a4+a5+a3=a1+a2+a6) then writeln('YES')
 else
  if (a1+a2+a6=a4+a5+a3) then writeln('YES')
 else
  if (a4+a2+a6=a1+a5+a3) then writeln('YES')
 else
  if (a1+a5+a6=a4+a2+a3) then writeln('YES')
 else
  writeln('NO');
  end
  else writeln('������');
end.

var
a,b,c,d,f,e,m,s:integer;
Begin
readln(a,b,c,d,e,f);

S:=(a+b+c+d+f+e);
m:=s div 2;
  if ( s mod 2 <>0) THEN WRITELN('no')
        else if (a+b+c=m) then WRITELN('YES')
        else if (a+c+d=m) then WRITELN('YES')
        else if (a+f+d=m) then WRITELN('YES')
        else if (a+f+e=m) then WRITELN('YES')
                else if (a+b+d=m) then WRITELN('YES')
                else if (a+c+f=m) then WRITELN('YES')
                else if (a+d+e=m) then WRITELN('YES')
                else if (a+b+f=m) then WRITELN('YES')
                 else if (a+b+e=m) then WRITELN('YES')
                else if (a+c+f=m) then WRITELN('YES')

        else if (b+c+d=m) then WRITELN('YES')
        else if (b+d+f=m) then WRITELN('YES')
        else if (b+f+e=m) then WRITELN('YES')
         else if (b+c+f=m) then WRITELN('YES')
         else if (b+d+e=m) then WRITELN('YES')

        else if (c+d+f=m) then WRITELN('YES')
        else if (c+f+e=m) then WRITELN('YES')
         else if (c+d+e=m) then WRITELN('YES')

        else if (d+f+e=m) then WRITELN('YES')

        else if (c+f+e=m) then WRITELN('no')

  end.

var p,d,k:integer;
a: array[1..6] of integer;
b: array[1..7] of integer;
flag:array[1..6] of boolean;
function prov:boolean;
 var f,o,s:integer;
 begin
 for o:=1 to 6 do if flag[o] then f:=f+a[o];
 for o:=1 to 6 do if flag[o]=false then s:=s+a[o];
 if s=f then prov:= true
  else prov:= false;
 end;
procedure search(x,q: integer);
var i:integer;
begin
 if q<3
  then
  begin
   for i:=x {1} to 6 do
   if flag[i]=false then
   begin
    b[q]:=a[i];
    flag[i]:=true;
    search(i+1,q+1);
    flag[i]:=false;
   end;
  end
  else
  begin
   if prov then d:=d+1;
   p:=p+1;
  end;
 end;
begin
for d:=1 to 6 do read(a[d]);
d:=0;
search(a[1],1);
if d=0 then writeln('NO')
 else writeln('YES');
end.

Program sad;
var i1,i2,i3,s:integer;
    m:array[1..6] of integer;
begin
for i1:=1 to 6 do
begin
read(m[i1]);
s:=s+m[i1];
end;
for i1:=1 to 6 do
for i2:=i1+1 to 6 do
for i3:=i2+1 to 6 do
if (m[i1]+m[i2]+m[i3])=s div 2 then writeln('YES') else writeln('NO');
end.

Program sad;
var i1,i2,i3,s:integer;
    m:array[1..6] of integer;
label 1;
begin
for i1:=1 to 6 do
begin
read(m[i1]);
s:=s+m[i1];
end;
for i1:=1 to 6 do
for i2:=i1+1 to 6 do
for i3:=i2+1 to 6 do
if (m[i1]+m[i2]+m[i3])=s div 2 then begin writeln('YES'); goto 1; end;
writeln('NO');
1:
end.

var a,b:array[1..1000] of integer;
i,n,k,s,j,m:integer;
begin
k:=0;
for i:=1 to 6 do
read(a[i]);
for i:=1 to 6 do
s:=s+a[i];
for i:=1 to 4 do
begin
for j:=2 to 6 do
begin
for m:=3 to 6 do
begin
if (i=j)or(i=m)or(j=m) then else if (s/2=a[i]+a[j]+a[m]) then begin k:=k+1; break end;
end;

end;
a[i]:=0;
end;
if k=0 then write('NO') else write('YES');

end.

var a,b:array[1..1000] of integer;
i,n,k,s,j:integer;
begin
for i:=1 to 6 do
read(a[i]);
for i:=1 to 6 do
s:=s+a[i];

for i:=1 to 10 do begin
for j:=1 to 5 do begin
if (i=j) and (j+1=i) then  else begin
b[i]:=a[i]+a[j]+a[j+1];
end;
end;
end;
for i:=1 to 10 do begin
if b[i]=s/2 then k:=k+1;
end;
if k=0 then write('NO') else write('YES');
end.

var a,b:array[1..1000] of integer;
i,n,k,s,j:integer;
begin
for i:=1 to 6 do
read(a[i]);
for i:=1 to 6 do
s:=s+a[i];

for i:=1 to 6 do begin
for j:=1 to 10 do begin
if (i=j) or (j+1=i) then  else begin
b[j]:=a[i]+a[j]+a[j+1];
end;
end;
end;
for i:=1 to 10 do begin
if b[i]=s/2 then k:=k+1;
end;
if k=0 then write('NO') else write('YES');
end.

Var
  m: array [1..6] of Word;

Begin
  For Var i := 1 to 6 do
    Read(m[i]);
  For Var i := 1 to 5 do
    For Var j := 1 to 6 - i do
      If m[j] > m[j + 1] then
        Swap(m[j], m[j + 1]);
  If m[1] + m[2] + m[6] = m[3] + m[4] + m[5] then
    Write('YES')
  Else Write('NO')
End.

Var
  m: array [1..6] of Word;

Begin
  For Var i := 1 to 6 do
    Read(m[i]);
  For Var i := 1 to 6 do
    For Var j := 2 to 6 do
      For Var l := 3 to 6 do
        For Var p := 4 to 6 do
          For Var q := 5 to 6 do
            For Var s := 6 to 6 do
        If m[i] + m[j] + m[l] = m[p] + m[q] + m[s] then Begin
          Write('YES');
          Exit
        End;
  Write('NO')
End.

Var
  m: array [1..6] of Word;

Begin
  For Var i := 1 to 6 do
    Read(m[i]);
  For Var i := 1 to 6 do
    For Var j := 2 to 6 do
      For Var l := 3 to 6 do
        For Var i1 := 4 to 6 do
          For Var j1 := 5 to 6 do
            For Var l1 := 6 to 6 do
        If m[i] + m[j] + m[l] = m[i1] + m[j1] + m[l1] then Begin
          Write('YES');
          Exit
        End;
  Write('NO')
End.

Var
  m: array [1..6] of Word;

Begin
  For Var i := 1 to 6 do
    Read(m[i]);
  For Var i := 1 to 6 do
    For Var j := 1 to 5 do
      For Var l := 1 to 4 do
        For Var i1 := 1 to 3 do
          For Var j1 := 1 to 2 do
            For Var l1 := 1 to 1 do
        If m[i] + m[j] + m[l] = m[i1] + m[j1] + m[l1] then Begin
          Write('YES');
          Exit
        End;
  Write('NO')
End.

Var
  m: array [1..6] of Word;

Begin
  For Var i := 1 to 6 do
    Read(m[i]);
  For Var i := 1 to 1 do
    For Var j := 1 to 2 do
      For Var l := 1 to 3 do
        If m[i] + m[j] + m[l] = m[i+3] + m[j+3] + m[l+3] then Begin
          Write('YES');
          Exit
        End;
  Write('NO')
End.

Var
  m: array [1..6] of Word;

Begin
  For Var i := 1 to 6 do
    Read(m[i]);
  For Var i := 1 to 1 do
    For Var j := 2 to 3 do
      For Var l := 3 to 4 do
        If m[i] + m[j] + m[l] = m[i + 2] + m[j + 2] + m[l + 2] then Begin
          Write('YES');
          Exit
        End;
  Write('NO')
End.

Var
  m: array [1..6] of Word;

Begin
  For Var i := 1 to 6 do
    Read(m[i]);
  For Var i := 1 to 1 do
    For Var j := 1 to 2 do
      For Var l := 1 to 3 do
        For Var i1 := 1 to 4 do
          For Var j1 := 1 to 5 do
            For Var l1 := 1 to 6 do
        If m[i] + m[j] + m[l] = m[i1] + m[j1] + m[l1] then Begin
          Write('YES');
          Exit
        End;
  Write('NO')
End.

Var
  m: array [1..6] of Word;

Begin
  For Var i := 1 to 6 do
    Read(m[i]);
  For Var i := 1 to 6 do
    For Var j := 2 to 6 do
      For Var l := 3 to 6 do
        If m[i] + m[j] + m[l] = m[7 - i] + m[7 - j] + m[7 - l] then Begin
          Write('YES');
          Exit
        End;
  Write('NO')
End.

var
a:array [1..6] of word;
i,j,k,s:byte;
t:boolean;
begin
for i:=1 to 6 do begin
read(a[i]);
s:=s+a[i];
end;
if s mod 2=0 then
for i:=1 to 4 do
 for j:=i+1 to 5 do
  for k:=j+1 to 6 do
   if a[i]+a[k]+a[j]=(s div 2) then t:=true;
if t=true then writeln('YES') else writeln ('NO');
end.

Var
  a : array of Integer;
  c, sum, i : Integer;
Begin
  a := new integer[6];
  Readln(a[1],a[2],a[3],a[4],a[5],a[0]);
  Sort(a);
  Reverse(a);
  sum := a[0];
  For i := 1 to 5 do
    begin
      If sum >= 0 then begin Dec(sum,a[i]); Inc(c); end else Inc(sum,a[i]);
    end;
  If (sum = 0) and (c = 3) then Writeln('YES') else Writeln('NO');
End.

var
i,j,k,sum:integer;
a:array [1..6] of integer;
log:boolean;
begin
read (a[1]);
read (a[2]);
read (a[3]);
read (a[4]);
read (a[5]);
read (a[6]);
sum:=a[1]+a[2]+a[3]+a[4]+a[5]+a[6];
for i:=1 to 6 do
begin
if log=true then break;
  for j:=1 to 6 do
  begin
if log=true then break;
    for k:=1 to 6 do
      if (i<>j) and (j<>k) and (i<>k) then if a[1]+a[j]+a[k]=k/2 then log:=true;
end;
end;
if log=FALSE then write('NO') else write('YES');
end.

var a: array[1..6] of integer; i, i2, i3, x, s: integer;

begin
  for i:=1 to 6 do read(a[i]);
  s:=a[1]+a[2]+a[3]+a[4]+a[5]+a[6];
      if s mod 2 = 0 then begin
      for i:=1 to 2 do begin
      for i2:=3 to 4 do begin
      for i3:=5 to 6 do begin
       if a[i]+a[i2]+a[i3]=(s/2) then inc(x);

      end;
      end;
      end;
      for i:=1 to 4 do begin
      if a[i]+a[i+1]+a[i+2]=(s/2) then inc(x); end;
      if x>=2 then writeln('YES') else writeln('NO');
      end
      else writeln('NO');

end.

var a: array[1..6] of integer; i, i2, i3, x, s: integer;

begin
  for i:=1 to 6 do read(a[i]);
  s:=a[1]+a[2]+a[3]+a[4]+a[5]+a[6];
      if s mod 2 = 0 then begin
      for i:=1 to 2 do begin
      for i2:=3 to 4 do begin
      for i3:=5 to 6 do begin
       if a[i]+a[i2]+a[i3]=(s/2) then inc(x);

      end;
      end;
      end;
      if x=2 then writeln('YES') else writeln('NO');
      end
      else writeln('NO');

end.

const n=6;
var a:array[1..n] of integer;
    i,s,j,m:integer;
    f:boolean;
Begin
  f:=true;
  for i:=1 to n do begin
    read(a[i]);
    s:=s+a[i];
  end;
  for i:=1 to n do if a[i]>=s-a[i] then f:=false;

  if (s mod 2=0) and (f=true) then begin
    f:=false;
    for i:=1 to n-2 do begin
      for j:=i+1 to n-1 do begin
        for m:=j+1 to n do begin
          if a[i]+a[j]+a[m]=s div 2 then f:=true;
        end;
      end;
    end;
  end
   else f:=false;
  if f=false then writeln('NO') else writeln('YES');
End.

Program eee;
Var s1: string; a: array [1..100000] of integer; j,sum,f,p,k,i: integer;
Begin
  readln(s1);
  f:=1;
  For i:= 1 to 6 do
  begin
   a[i]:=ReadIntegerFromString(s1,f);
   writeln(a);
   sum:=sum+a[i]
  end;
  For i:= 1 to 4 do
   For j:= i+1 to 5 do
    For p:= j+1 to 6 do
    begin
    if (a[i]+a[j]+a[p])=(sum-(a[i]+a[j]+a[p])) then k:=1;
    end;
  If k=1 then writeln('YES') else writeln('NO');
end.

var

sum,i,x,j,z: longint;
a: array [1..6] of longint;

BEGIN
    sum:=0;
    for i:=1 to 6 do begin read(a[i]); sum:=sum + a[i]; end;

    for i:=1 to 4 do
      for j:=i+1 to 5 do
        for z:=j+1 to 6 do
          if a[i]+a[j]+a[z] = sum - a[i]+a[j]+a[z] then begin writeln('YES'); halt; end;
    writeln('NO');

END.

var i,j,k:Longint;
	a:array[0..2000] of Longint;
begin
	for i:=1 to 6 do
	begin
		read(k);
		inc(a[k]);
		for j:=0 to 1000 do
			if (a[j]>0) and (j<>k) then
				inc(a[j+k]);
	end;
	for i:=0 to 1000 do
	if (a[i] mod 2=0) and (a[i]>0) then begin writeln('YES'); exit; end;
	writeln('NO');
end.

var i,j,s,k:Longint;
	a:array[1..6] of Longint;
begin
	s:=0;
	for i := 1 to 6 do
	begin
		read(a[i]);
		s:=s+a[i];
	end;
	s:=s div 2;
	for i:=1 to 4 do
		begin
			for j:=i+1 to 5 do
			for k:=j+1 to 6 do
			if a[i]+a[j]+a[k]=s then
				begin
					writeln('YES');
					exit;
				end;
		end;
	writeln('NO');
end.

var i,j,k:Longint;
	a:array[0..2000] of Longint;
begin
	for i:=1 to 6 do
	begin
		read(k);
		for j:=0 to 1000 do
			if a[j]>0 then
				inc(a[j+k]);
	end;
	for i:=0 to 1000 do
	if (a[i] mod 2=0) and (a[i]>0) then begin writeln('YES'); exit; end;
	writeln('NO');
end.

   const eps=0.0000000001;  besk1=200000008;  nn=200000;
   label 1,2;
    type    real=extended;  {string=ansistring;}
    mas=array [-100..nn] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[0..nn] of int64;mass1=^mass;
    var p,tt,time,y,z,pmax,imax,p1,p2,p3,p4,t,l,ot,nm,n,s1,s2,m,s,smin,cen,dl,t2,i1,besk:int64;
    mask,step, k,ii,i,j:longint;
     aa,bb,cc:double;
     x,aold,b,a:array[-10..2000000] of int64;
     dda:array[-10..1200,-10..1200] of int64;
   zanx,zany:array[-10..2000000] of boolean;
    sss, ss1,ss2:string;
     fl:array[0..200000] of boolean;
    ss:string;ch:char;
    pole :array [-10..2000,-10..2000] of char;
    maxpr:array[0..nn] of string;
    st2:array[0..nn] of string;
     v0,v1,s0,t0:real;
     zv:point;
     newx,newy,xx,yy:array[-1..200000] of int64;

     yot:double;
       flag,flag1:boolean;
    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p/pi*180;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

begin
   { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
    }
   n:=6;
  for i:=1 to n do read(a[i]);

  ot:=0; for i:=1 to n do ot:=ot+a[i];

  for mask:=0 to 63 do
    begin
      p:=mask;
      tt:=0;
      for i:=1 to 6 do begin
      x[i]:=p and 1; p:=p shr 1; end;

      for i:=1 to 6 do tt:=tt+a[i]*x[i];

    {  writeln('mask= ',mask,' tt= ',tt);
    }  if tt=ot-tt then begin writeln('YES'); goto 1;  end;

    end;

    writeln('NO');

   1:          close(output);
end.

var m: array [1..6] of integer;
i,k,j:integer;
begin

for i:= 1 to 6 do
read(m[i]);

for i:=1 to 5 do begin
    for j:=1 to 6-i do begin
    if m[j]>m[j+1] then begin
      k:=m[j];
      m[j]:=m[j+1];
      m[j+1]:=k;
    end;
  end;
end;

   if (m[1]+m[6]+m[3]=m[4]+m[5]+m[2]) or (m[1]+m[6]+m[4]=m[3]+m[5]+m[2])  then write('Yes')
   else write('No');

end.

var m: array [1..6] of integer;
i,k,j:integer;
begin

for i:= 1 to 6 do
read(m[i]);

for i:=1 to 5 do begin
    for j:=1 to 6-i do begin
    if m[j]>m[j+1] then begin
      k:=m[j];
      m[j]:=m[j+1];
      m[j+1]:=k;
    end;
  end;
end;

   if (m[1]+m[6]+m[3]=m[4]+m[5]+m[2]) or (m[1]+m[6]+m[4]=m[3]+m[5]+m[2]) or (m[2]+m[4]+m[6]=m[1]+m[3]+m[5])  then write('Yes')
   else write('No');

end.

var
  b, c, d, i, n, k, i1, j, p,i2: integer;
  o:real;
  a: array [1..100000] of int64;

begin
  for i := 1 To 6 Do begin
  Read(a[i]); o := o + a[i] end;
  o:=o/2;
  k:=0;
  for i := 1 To 6 Do
    for i1 := 2 To 6 Do
      for i2 := 3 To 6 Do
        if a[i] + a[i1] + a[i2] = o then k := 1;
  if k = 1 then writeln('YES')
  else
    writeln('NO')
end.

program ph;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  i, j, sum, k: integer;
  a: array[1..6] of integer;
begin
  sum := 0;
  for i := 1 to 6 do begin
    read(a[i]);
    sum := sum + a[i];
  end;

  for i := 1 to 6 do
    for j := 1 to 6 do
      for k := 1 to 6 do
      if (a[i] + a[j] + a[k] = (sum div 2)) and (i <> j) and (j <> k) and (i <> k) then begin
        writeln('YES');
        exit;
      end;
  writeln('NO');
end.

var a:array[1..6]of integer;
    b:array[1..6]of boolean;
    i,k,j,l,z:integer;
    f:boolean;
begin
f:=false;
for i:=1  to 6 do begin read(a[i]);k:=k+a[i];b[i]:=true; end;
if k mod 2 = 1 then write('NO')
else begin

for j:=1 to 6 do

if a[6]>(a[1]+a[2]+a[3])then begin write('NO');f:=true;break;end;
for i:=1 to 4 do
for j:=i to 5 do
for l:=j to 6 do
begin
if f then break;
k:=0;
for z:=1 to 6 do if (z<>i)and(z<>j)and(z<>l)then k:=k+a[z];
if a[i]+a[j]+a[l]=k then begin write('YES');f:=true;break;end;
end;
end;
end.

var a:array[1..6]of integer;
    b:array[1..6]of boolean;
    i,k,j,l,z:integer;
    f:boolean;
begin
f:=false;
for i:=1  to 6 do begin read(a[i]);k:=k+a[i];b[i]:=true; end;
if k mod 2 = 1 then begin write('NO');f:=true;end
else begin
//if a[6]>(a[1]+a[2]+a[3])then begin write('NO');f:=true;break;end;
for i:=1 to 4 do
for j:=i+1 to 5 do
for l:=j+1 to 6 do
begin
if f then break;
k:=0;
for z:=1 to 6 do if (z<>i)and(z<>j)and(z<>l)then k:=k+a[z];
if (a[i]+a[j]+a[l]=k)and(i<>j)and(j<>l)and(l<>i) then begin write('YES');f:=true;break;end;
end;
end;
if not(f) and (i=4)and(j=5)and(l=6)then write('NO');
end.

var a:array[1..6]of integer;
    b:array[1..6]of boolean;
    i,k,j,l,z:integer;
    f:boolean;
begin
f:=false;
for i:=1  to 6 do begin read(a[i]);k:=k+a[i];b[i]:=true; end;
if k mod 2 = 1 then write('NO')
else begin

for j:=1 to 6 do

if a[6]>(a[1]+a[2]+a[3])then begin write('NO');f:=true;break;end;
for i:=1 to 4 do
for j:=i+1 to 5 do
for l:=j+1 to 6 do
begin
if f then break;
k:=0;
for z:=1 to 6 do if (z<>i)and(z<>j)and(z<>l)then k:=k+a[z];
if (a[i]+a[j]+a[l]=k)and(i<>j)and(j<>l)and(l<>i) then begin write('YES');f:=true;break;end;
end;
end;
if not(f) and (i=4)and(j=5)and(l=6)then write('NO');
end.

var a:array[1..6]of integer;
    b:array[1..6]of boolean;
    i,k,j,l,z:integer;
    f:boolean;
begin
f:=false;
for i:=1  to 6 do begin read(a[i]);k:=k+a[i];b[i]:=true; end;
//if k mod 2 = 1 then begin write('NO');f:=true;end

for i:=1 to 4 do
for j:=i+1 to 5 do
for l:=j+1 to 6 do
begin
if f then break;
k:=0;
for z:=1 to 6 do if (z<>i)and(z<>j)and(z<>l)then k:=k+a[z];
if (a[i]+a[j]+a[l]=k)and(i<>j)and(j<>l)and(l<>i) then begin write('YES');f:=true;break;end;
end;
if not(f) and (i=4)and(j=5)and(l=6)then write('NO');
end.

var a:array[1..6]of integer;
    i,i1,i2,i3,i4,i5,i6:integer;
    f:boolean;
begin
f:=false;
for i:=1 to 6 do read(a[i]);
for i1:=1 to 6 do
for i2:=1 to 6 do
if i1<>i2 then
for i3:=1 to 6 do
if (i3<>i2)and(i3<>i1) then
for i4:=1 to 6 do
if (i4<>i3)and(i4<>i2)and(i4<>i1)then
for i5:=1 to 6 do
if (i5<>i4)and(i5<>i3)and(i5<>i2)and(i5<>i1)then
for i6:=1 to 6 do
if (i6<>i5)and(i6<>i4)and(i6<>i3)and(i6<>i2)and(i6<>i1)then
if ((a[i1]+a[i2]+a[i3]-a[i4]-a[i5]-a[i6])=0)then begin writeln(i1,' ',i2,' ',i3,' ',i4,' ',i5,' ',i6); f:=true;end;
if f then write('YES')else write('NO');
end.

var a:array[1..6]of integer;
    i,i1,i2,i3,i4,i5,i6:integer;
    f:boolean;
begin
f:=false;
for i:=1 to 6 do read(a[i]);
for i1:=1 to 6 do
for i2:=1 to 6 do
if i1<>i2 then
for i3:=1 to 6 do
if (i3<>i2)and(i3<>i1) then
for i4:=1 to 6 do
if (i4<>i3)and(i4<>i2)and(i4<>i1)then
for i5:=1 to 6 do
if (i5<>i4)and(i5<>i3)and(i5<>i2)and(i3<>i1)then
for i6:=1 to 6 do
if (i6<>i5)and(i6<>i4)and(i6<>i3)and(i6<>i2)and(i6<>i1)then
if ((a[i1]+a[i2]+a[i3]-a[i4]-a[i5]-a[i6])=0)then f:=true;
if f then write('YES')else write('NO');
end.

var a:array[1..6]of integer;
    b:array[1..6]of boolean;
    i,k,j,l,z:integer;
    f:boolean;
begin
f:=false;
for i:=1  to 6 do begin read(a[i]);k:=k+a[i];b[i]:=true; end;
if k mod 2 = 1 then begin write('NO');f:=true;end
else begin

for i:=1 to 4 do
for j:=i+1 to 5 do
for l:=j+1 to 6 do
begin
if f then break;
k:=0;
for z:=1 to 6 do if (z<>i)and(z<>j)and(z<>l)then k:=k+a[z];
if (a[i]+a[j]+a[l]=k)and(i<>j)and(j<>l)and(l<>i) then begin write('YES');f:=true;break;end;
end;
end;
if not(f) and (i=4)and(j=5)and(l=6)then write('NO');
end.

var a:array[1..6]of integer;
    b:array[1..6]of boolean;
    i,k,j,l,z:integer;
    f:boolean;
begin
f:=false;
for i:=1  to 6 do begin read(a[i]);k:=k+a[i];b[i]:=true; end;
if k mod 2 = 1 then write('NO')
else begin

for j:=1 to 6 do

if a[6]>(a[1]+a[2]+a[3])then begin write('NO');f:=true;break;end;
for i:=1 to 4 do
for j:=i to 5 do
for l:=j to 6 do
begin
if f then break;
k:=0;
for z:=1 to 6 do if (z<>i)and(z<>j)and(z<>l)then k:=k+a[z];
if (a[i]+a[j]+a[l]=k)and(i<>j)and(j<>l)and(l<>i) then begin write('YES');f:=true;break;end;
end;
end;
end.

var a:array[1..6]of integer;
    b:array[1..6]of boolean;
    i,k,j,l,z:integer;
    f:boolean;
begin
f:=false;
for i:=1  to 6 do begin read(a[i]);k:=k+a[i];b[i]:=true; end;
if k mod 2 = 1 then begin write('NO');f:=true;end
else begin

for j:=1 to 6 do

if a[6]>(a[1]+a[2]+a[3])then begin write('NO');f:=true;break;end;
for i:=1 to 4 do
for j:=i+1 to 5 do
for l:=j+1 to 6 do
begin
if f then break;
k:=0;
for z:=1 to 6 do if (z<>i)and(z<>j)and(z<>l)then k:=k+a[z];
if (a[i]+a[j]+a[l]=k)and(i<>j)and(j<>l)and(l<>i) then begin write('YES');f:=true;break;end;
end;
end;
if not(f) and (i=4)and(j=5)and(l=6)then write('NO');
end.

program firsttt;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  i, j, sum, k: integer;
  a: array[1..6] of integer;

begin
  sum := 0;
  for i := 1 to 6 do begin
    read(a[i]);
    inc(sum, a[i]);
  end;

  for i := 1 to 6 do begin
    for j := 1 to 6 do
      for k := 1 to 6 do
        if (a[i] + a[j] + a[k] = sum - (a[i] + a[j] + a[k])) then begin
          writeln('YES');
          halt(0);
        end;
  end;
  writeln('NO');
end.

var a:array[1..6] of integer; i,j,k,l,m,n,a1,k1,n1,j1:integer;
begin
n1:=0;
j1:=0;
k1:=0;
l:=0;
for i:=1 to 6 do
begin
read(a1);
a[i]:=a1;
l:=l+a1;
end;
m:=0;
if l mod 2=0 then
begin
l:=l div 2;
for j:=1 to 6 do
for k:=1 to 6 do
for n:=1 to 6 do
if (a[j]+a[k]+a[n]=l) and (n<>k) and (j<>k) and (n1<>k) and(n<>j) and (j1<>k) and (k1<>k) and (n1<>n) and (j1<>n) and (k1<>n) and (n1<>j) and (j1<>j) and (k1<>j)  then
begin
inc(m);
n1:=n;
j1:=j;
k1:=k;
end;
if m=2 then
writeln('YES');
if m<=1 then
writeln('NO');
end
else
writeln('NO');
end.

var a:array[1..6] of integer; i,j,k,l,m,n,a1:integer;
begin
l:=0;for i:=1 to 6 do
begin
read(a1);
a[i]:=a1;
l:=l+a1;
end;
m:=0;
if l mod 2=0 then
begin
l:=l div 2;
for j:=1 to 6 do
for k:=1 to 6 do
for n:=1 to 6 do
if (a[j]+a[k]+a[n]=l) and (n<>k) and (j<>k) then
begin
inc(m);
a[n]:=1001;
a[j]:=1001;
a[k]:=1001;
end;
if m=2 then
writeln('YES');
if m<=1 then
writeln('NO');
end
else
writeln('NO');
end.

var a:array[1..6] of integer; i,j,k,l,m,n,a1,k1,n1,j1:integer;
begin
n1:=0;
j1:=0;
k1:=0;
l:=0;
for i:=1 to 6 do
begin
read(a1);
a[i]:=a1;
l:=l+a1;
end;
m:=0;

for j:=1 to 6 do
for k:=1 to 6 do
for n:=1 to 6 do
for j1:=1 to 6 do
for k1:=1 to 6 do
for n1:=1 to 6 do
begin
if m>0 then
break
else
if (a[j]+a[k]+a[n]= a[j1]+a[k1]+a[n1]) and (n+j+k+n1+j1+k1=21)  then
begin
inc(m);
break;
end;
end;
if m=1 then
writeln('YES');
if m<1 then
writeln('NO');
end.

var a:array[1..6] of integer; i,j,k,l,m,n,a1,k1,n1,j1:integer;
begin
n1:=0;
j1:=0;
k1:=0;
l:=0;
for i:=1 to 6 do
begin
read(a1);
a[i]:=a1;
l:=l+a1;
end;
m:=0;
if l mod 2=0 then
begin
for j:=1 to 6 do
for k:=1 to 6 do
for n:=1 to 6 do
for j1:=1 to 6 do
for k1:=1 to 6 do
for n1:=1 to 6 do
begin
if m>0 then
break
else
if (a[j]+a[k]+a[n]= a[j1]+a[k1]+a[n1]) and (n+j+k+n1+j1+k1=21)  then
begin
inc(m);
break;
end;
end;
if m=1 then
writeln('YES');
if m<1 then
writeln('NO')
end
else
writeln('no');
end.

var a:array[1..6] of integer; i,j,k,l,m,n,a1,k1,n1,j1:integer;
begin
n1:=0;
j1:=0;
k1:=0;
l:=0;
for i:=1 to 6 do
begin
read(a1);
a[i]:=a1;
l:=l+a1;
end;
m:=0;
if l mod 2=0 then
for j:=1 to 6 do
for k:=1 to 6 do
for n:=1 to 6 do
for j1:=1 to 6 do
for k1:=1 to 6 do
for n1:=1 to 6 do
begin
if m>0 then
break
else
if (a[j]+a[k]+a[n]= a[j1]+a[k1]+a[n1]) and (n+j+k+n1+j1+k1=21)  then
begin
inc(m);
break;
end;
end;
if m=1 then
writeln('YES');
if m<1 then
writeln('NO');
if l mod 2=1 then
writeln('no');
end.

var n,d,i,x,l,j :integer; a:array of integer;
begin
l:=0;
read(n);
read(d);
setlength(a,n);
for i:=0 to n-1 do
begin
read(x);
a[i]:=x;
end;
for i:=0 to n-1 do
begin
x:=a[i];
for j:=0 to n-1 do
begin
if x+d=a[j] then
begin
inc(l);
break;
end;
end;

end;
writeln(l);
end.

var
flag: boolean;
sum, sum1, i, j, k, l, m: int64;
massum, massum1: array[1..20] of int64;
mas: array[1..6] of integer;

begin
flag := false;
l := 1;
for i := 1 to 6 do
begin
read(mas[i]);
end;
for i := 1 to 6 do
begin
for j := 1 to 6 do
begin
if (not (j = i)) then
for k := 1 to 6 do
begin
if ((not (k = i)) or (not (k = j))) then
begin
sum := mas[i] + mas[j] + mas[k];
for m := 1 to 6 do
begin
if ((m = i) or (m = i) or (m = i)) then
begin
end
else
begin
sum1 := mas[m] + sum1;
end;
end;
if (sum = sum1) then flag := true;
sum1 := 0;
end;
end;
end;
end;
if (flag) then write('YES') else write('NO');
end.

var
flag: boolean;
sum, sum1, i, j, k, l, m: int64;
massum, massum1: array[1..20] of int64;
mas: array[1..6] of integer;

begin
flag := false;
l := 1;
for i := 1 to 6 do
begin
read(mas[i]);
end;
for i := 1 to 6 do
begin
for j := 1 to 6 do
begin
if (not (j = i)) then
for k := 1 to 6 do
begin
if ((not (k = i)) and (not (k = j))) then
begin
sum := mas[i] + mas[j] + mas[k];
for m := 1 to 6 do
begin
if ((m = i) or (m = i) or (m = i)) then
begin
end
else
begin
sum1 := mas[m] + sum1;
end;
end;
if (sum = sum1) then flag := true;
sum1 := 0;
end;
end;
end;
end;
if (flag) then write('YES') else write('NO');
end.

var
flag: boolean;
sum, sum1, i, j, k, l, m: int64;
massum, massum1: array[1..20] of int64;
mas: array[1..6] of integer;

begin
flag := false;
l := 1;
for i := 1 to 6 do
begin
read(mas[i]);
end;
for i := 1 to 6 do
begin
for j := i + 1 to 6 do
begin
for k := j + 1 to 6 do
begin
sum := mas[i] + mas[j] + mas[k];
for m := 1 to 6 do
begin
if ((m = i) or (m = i) or (m = i)) then
begin
end
else
begin
sum1 := mas[m] + sum1;
end;
end;
if (sum = sum1) then flag := true;
sum1:= 0;
end;
end;
end;
if (flag) then write('YES') else write('NO');
end.

var a:array[0..6] of longint;
 i,j,z,x,max,c,z1,x1: longint;
 begin
 for i:=1 to 6 do
 read(a[i]);
 for i:=1  to 6 do begin
  max:=0;
  for j:=1 to 6 do
  if a[j]>max then begin max:=a[j]; c:=j; end;
  if (z<x) and (z1<3) then begin z:=z+max  ;inc(z1) end
                             else if (x1<3) then begin x:=x+max; inc(x1); end;
  a[c]:=0;
  end;
  if z=x then writeln('YES') else writeln('NO');

 end.

program z1;
var a:array[1..6] of integer;i,o,j,l,f:integer;
begin
for i:= 1 to 6 do begin
read(a[i]);inc(o,a[i]);end;
for j:= 1 to 6 do
for i:= 1 to 6 do
for l:= 1 to 6 do
if a [j]+a[i]+a[l]=o-(a[j]+a[i]+a[l]) then begin f:= 1; break;end;
if f=1 then write('YES')
else write('NO');
end.

var
    i,j,t,s1,s2:longint; a:array[1..6] of integer;
begin
     for i:=1 to 6 do read(a[i]);
     for i:=1 to 5 do
         for j:=i to 6-i do
             if a[j]>a[j+1] then
                begin
                     t:=a[i]; a[i]:=a[i+1]; a[i+1]:=t;
                end;
     s1:=a[1]+a[3]+a[6];
     s2:=a[2]+a[4]+a[5];
     if s1=s2 then writeln('YES') else writeln('NO');
end.

var
    i,j,t,s1,s2:longint; a:array[1..6] of integer;
begin
     for i:=1 to 6 do read(a[i]);
     for i:=1 to 5 do
         for j:=i to 6-i do
             if a[j]>a[j+1] then
                begin
                     t:=a[i]; a[i]:=a[i+1]; a[i+1]:=t;
                end;
     s1:=a[1]+a[4]+a[6];
     s2:=a[2]+a[3]+a[5];
     if s1=s2 then writeln('YES') else writeln('NO');
end.

var  m,j,l,i,u,k:int32;
a:array[0..6] of int32;
begin
{assign(input,'input.txt' );
assign(output,'output.txt');
reset(input);
rewrite(output);}
for i:=1 to 6 do
  begin
  read(a[i]);
  k+=a[i];
  end;
if k mod 2=0 then
for i:=1 to 6 do
  if i<>j then
  for j:=1 to 6 do
    if (i<>l) and (j<>l) then
      for l:=1 to 6 do
        if k div 2=a[i]+a[j]+a[l] then
          begin
            write('YES');
            exit;
          end;
write('NO')
end.

var  m,j,l,i,u,k:int32;
a:array[0..6] of int32;
begin
{assign(input,'input.txt' );
assign(output,'output.txt');
reset(input);
rewrite(output); }
for i:=1 to 6 do
  begin
  read(a[i]);
  k+=a[i];
  end;
if k mod 2=0 then
for i:=1 to 6 do
  if i<>j then
  for j:=1 to 6 do
    if (i<>j) and (j<>l) then
      for l:=1 to 6 do
        if k div 2=a[i]+a[j]+a[l] then
          begin
            write('YES');
            exit;
          end;
write('NO')
end.

Const
	fi='';
	fo='';

Var	f:text;
	sum:longint;
	a:array [1..6] of longint;

Procedure NhapDL;
var	i:word;
begin
	sum:=0;
	assign(f,fi); Reset(f);
	For i:= 1 to 6 do
	begin
		read(f,a[i]);
		sum:=sum+a[i];
        end;
	Close(f);
end;

Procedure Xuly;
var	x,y,z,tmp:longint;
begin
	assign(f,fo); Rewrite(F);
	For x:= 1 to 4 do
	For y:= x+ 1 to 5 do
	For z:= y+1 to 6 do
		if a[x] +a[y] +a[z] = (sum div 2) then
		begin
			Writeln(f,'YES');
			Close(f);
			Halt;
		end;
	WRite(f,'NO');
	Close(f);
end;

Begin
	NhapDL;
	Xuly;
end.

var n,i:longint;
a:Array[0..10] of longint;
flag:boolean;

procedure dfs(k,s:longint);
begin
  if s=a[0] then begin flag:=true;exit;end;
  if k>n then exit;
  dfs(k+1,s);
  if flag then exit;
  dfs(k+1,s+a[k]);
end;

begin
  n:=6;
  for i:=1 to n do
  begin
    read(a[i]);
    a[0]:=a[0]+a[i];
  end;
  if a[0] mod 2=1 then begin write('no');halt;end;
  a[0]:=a[0]>>1;
  flag:=false;
  dfs(1,0);
  if flag then writeln('yes')
  else writeln('no');
end.

var
  a: array[1..6]of integer;
  i, s, n: integer;

begin
  n := 6;
  for i := 1 to n do
  begin
    read(a[i]);
    s := s + a[i];
  end;
  if s mod 2 <> 0 then writeLn('no')
  else writeLn('yes');
end.

var
  a: array[1..6]of integer;
  i, s, n, j, z: integer;
  fl: boolean;

begin
  n := 6;
  for i := 1 to n do
  begin
    read(a[i]);
    s := s + a[i];
  end;
  fl := false;
  if s mod 2 <> 0 then writeLn('no')
  else
  begin
    for i := 1 to n do
      for j := i + 1 to n do
        for z := j + 1 to n do
          if a[i] + a[j] + a[z] = s div 2 then
          begin
            fl := true;
            break;
          end;
  end;
  if fl then writeLn('yes');
end.

var A, B: array[1..6] of integer;
    i, j, sum, select: integer;
    ans: string;

procedure binary(n: integer);
var i, du: integer;
begin
  i:=6; du:=0;
  while n<>0 do
    begin
      du:=n mod 2;
      n:=n div 2;
      B[i]:=du; dec(i);
    end;
end;

begin
  for i:=1 to 6 do
    begin
      read(A[i]);
      sum:=sum+A[i];
    end;
  readln; ans:='NO';
  for i:=0 to 63 do
    begin
      binary(i); select:=0;
      for j:=1 to 6 do
        if B[j]=1 then select:=select+A[j];
      if 2*select=sum then
        begin
          ans:='YES';
          break;
        end;
    end;
  write(ans);
end.