#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a[6];
  for (long long i = 0; i < 6; i++) {
    cin >> a[i];
  }
  long long flag = 0;
  sort(a, a + 6);
  do {
    if (a[0] + a[1] + a[2] == a[3] + a[4] + a[5]) {
      flag = 1;
      break;
    }
  } while (next_permutation(a, a + 6));
  if (flag == 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
