#include <bits/stdc++.h>
using namespace std;
int main() {
  int player[6];
  for (int i = 0; i < 6; i++) cin >> player[i];
  sort(player, player + 6);
  if (player[5] + player[0] + player[1] > (player[2] + player[3] + player[4])) {
    cout << "NO" << endl;
    return 0;
  }
  if ((player[5] + player[0] + player[1] + player[2] + player[3] + player[4]) %
          2 ==
      1) {
    cout << "NO" << endl;
    return 0;
  } else {
    int score = (player[5] + player[0] + player[1] + player[2] + player[3] +
                 player[4]) /
                2;
    score -= player[5];
    if (player[0] + player[1] == score) {
      cout << "YES" << endl;
      return 0;
    }
    if (player[0] + player[2] == score) {
      cout << "YES" << endl;
      return 0;
    }
    if (player[0] + player[3] == score) {
      cout << "YES" << endl;
      return 0;
    }
    if (player[0] + player[4] == score) {
      cout << "YES" << endl;
      return 0;
    }
    if (player[1] + player[2] == score) {
      cout << "YES" << endl;
      return 0;
    }
    if (player[1] + player[3] == score) {
      cout << "YES" << endl;
      return 0;
    }
    if (player[1] + player[4] == score) {
      cout << "YES" << endl;
      return 0;
    }
    if (player[2] + player[3] == score) {
      cout << "YES" << endl;
      return 0;
    }
    if (player[2] + player[4] == score) {
      cout << "YES" << endl;
      return 0;
    }
    if (player[3] + player[4] == score) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}
