#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(6);
  int i, j, k;
  cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
  int s = a[0] + a[1] + a[2] + a[3] + a[4] + a[5];
  if (s % 2 == 1) {
    cout << "NO";
    return 0;
  }
  s /= 2;
  for (i = 0; i < 6; i++) {
    for (j = 0; j < 6; j++) {
      for (k = 0; k < 6; k++) {
        if (k != j && k != i && i != j && a[i] + a[j] + a[k] == s) {
          cout << "YES";
          return 0;
        }
      }
    }
  }
  cout << "NO";
  return 0;
}
