#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[6];
  int sum1, sum2, sum3, k;
  k = 0;
  sum2 = 0;
  for (int b = 0; b < 6; b++) {
    cin >> a[b];
    sum2 += a[b];
  }
  for (int z = 0; z < 4; z++) {
    for (int x = z + 1; x < 5; x++) {
      for (int c = x + 1; c < 6; c++) {
        sum1 = a[z] + a[x] + a[c];
        sum3 = sum2 - sum1;
        if (sum1 == sum3) {
          k += 1;
        }
      }
    }
  }
  if (k == 0) {
    cout << "NO";
  } else {
    cout << "YES";
  }
  return 0;
}
