#include <bits/stdc++.h>
typedef struct input {
  int in;
};
input in[1100];
bool cmp(input a, input b) { return a.in > b.in; }
using namespace std;
int main() {
  int a[10];
  for (int i = 0; i < 6; i++) {
    cin >> a[i];
  }
  int num = 5, t1, t2, t3;
  for (int i = 0; i < 6; i++) {
    for (int j = i + 1; j < 6; j++) {
      int tem;
      if (a[i] > a[j]) {
        tem = a[i];
        a[i] = a[j];
        a[j] = tem;
      }
    }
  }
  if (a[0] + a[1] + a[2] == a[3] + a[4] + a[5])
    cout << "YES";
  else if (a[0] + a[1] + a[3] == a[2] + a[4] + a[5])
    cout << "YES";
  else if (a[0] + a[1] + a[4] == a[2] + a[3] + a[5])
    cout << "YES";
  else if (a[0] + a[1] + a[5] == a[2] + a[3] + a[4])
    cout << "YES";
  else if (a[0] + a[2] + a[3] == a[1] + a[4] + a[5])
    cout << "YES";
  else if (a[0] + a[2] + a[4] == a[1] + a[3] + a[5])
    cout << "YES";
  else if (a[0] + a[2] + a[5] == a[1] + a[3] + a[4])
    cout << "YES";
  else if (a[0] + a[3] + a[4] == a[1] + a[2] + a[5])
    cout << "YES";
  else if (a[0] + a[3] + a[5] == a[1] + a[2] + a[4])
    cout << "YES";
  else if (a[0] + a[4] + a[5] == a[1] + a[2] + a[3])
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
