#include <bits/stdc++.h>
using namespace std;
int main() {
  int score[6], sum = 0, inSum;
  bool can = false;
  for (int i = 0; i < 6; i++) {
    cin >> score[i];
    sum += score[i];
  }
  if (sum % 2 == 0) {
    for (int i = 0; i < 4 && !can; i++) {
      for (int j = i + 1; j < 5 && !can; j++) {
        for (int k = j + 1; k < 6 && !can; k++) {
          inSum = score[i] + score[j] + score[k];
          if (inSum == sum / 2) {
            can = true;
          }
        }
      }
    }
  }
  if (can)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
