#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 6;
  int a[n];
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        if ((a[i] + a[j] + a[k]) == sum - (a[i] + a[j] + a[k]) && i != j &&
            j != k && k != i) {
          cout << "YES";
          return 0;
        }
      }
    }
  }
  cout << "NO";
  return 0;
}
