#include <bits/stdc++.h>
using namespace std;
void solve() {
  vector<long long> a(6);
  long long s = 0;
  for (long long i = 0; i < 6; i++) {
    cin >> a[i];
    s += a[i];
  }
  sort(a.begin(), a.end());
  for (long long i = 0; i < 6; i++) {
    for (long long j = i + 1; j < 6; j++) {
      for (long long k = j + 1; k < 6; k++) {
        if (s - a[i] - a[j] - a[k] == a[i] + a[j] + a[k]) {
          cout << "YES\n";
          return;
        }
      }
    }
  }
  cout << "NO\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout.precision(30);
  long long t = 1;
  while (t--) solve();
}
