#include <bits/stdc++.h>
using namespace std;
int main(void) {
  vector<int> v(6);
  for (auto& i : v) {
    cin >> i;
  }
  const int sum = accumulate(v.begin(), v.end(), 0);
  if (sum % 2) {
    cout << "NO" << endl;
    return 0;
  }
  for (int i1 = 0; i1 < v.size(); ++i1) {
    for (int i2 = i1 + 1; i2 < v.size(); ++i2) {
      for (int i3 = i2 + 1; i3 < v.size(); ++i3) {
        if (sum / 2 == v[i1] + v[i2] + v[i3]) {
          cout << "YES" << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
