#include <bits/stdc++.h>
using namespace std;
class ADiverseStrings {
 public:
  void solve(std::istream& in, std::ostream& out) {
    int v[6], i;
    for (i = 0; i < 6; i++) cin >> v[i];
    sort(v, v + 6);
    if ((v[0] + v[1] + v[5] == v[2] + v[3] + v[4]) ||
        (v[0] + v[4] + v[5] == v[1] + v[2] + v[3]) ||
        (v[1] + v[2] + v[5] == v[0] + v[3] + v[4]) ||
        (v[1] + v[2] + v[4] == v[0] + v[3] + v[5]) ||
        (v[2] + v[3] + v[5] == v[0] + v[1] + v[4]) ||
        (v[0] + v[2] + v[5] == v[1] + v[3] + v[4]))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
};
int main() {
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  ADiverseStrings Solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  Solver.solve(in, out);
  return 0;
}
