#include <bits/stdc++.h>
using namespace std;
int a[7];
int main() {
  int sum = 0, sum1 = 0;
  for (int i = 0; i < 6; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum % 2 == 1) {
    cout << "NO" << endl;
    return 0;
  }
  sum /= 2;
  for (int i = 0; i < 6; i++) {
    for (int j = 0; j < 6; j++) {
      if (i == j) continue;
      for (int w = 0; w < 6; w++) {
        if (j == w || i == w) continue;
        sum1 = a[i] + a[w] + a[j];
        if (sum1 == sum) {
          cout << "YES";
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
