#include <bits/stdc++.h>
using namespace std;
int main() {
  int T[5];
  int team1 = 0;
  int team2 = 0;
  int team3 = 0;
  int team4 = 0;
  int team5 = 0;
  int team6 = 0;
  int team7 = 0;
  int team8 = 0;
  int team9 = 0;
  int team10 = 0;
  for (int i = 0; i < 6; i++) {
    cin >> T[i];
  }
  sort(T, T + 6);
  team1 = T[5] + T[0] + T[1];
  team2 = T[4] + T[2] + T[3];
  team3 = T[5] + T[1] + T[2];
  team4 = T[4] + T[0] + T[3];
  team5 = T[5] + T[0] + T[2];
  team6 = T[1] + T[4] + T[3];
  team7 = T[5] + T[0] + T[4];
  team8 = T[1] + T[2] + T[3];
  team9 = T[5] + T[0] + T[3];
  team10 = T[1] + T[2] + T[4];
  if (team1 == team2 || team3 == team4 || team5 == team6 || team7 == team8 ||
      team9 == team10) {
    cout << "YES";
  } else
    cout << "NO";
}
