#include <bits/stdc++.h>
using namespace std;
void doRoutine() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
signed main() {
  doRoutine();
  vector<long long int> a(6);
  long long int s = 0;
  for (long long int i = 0; i < 6; i++) {
    cin >> a[i];
    s += a[i];
  }
  for (long long int i = 0; i < 6; i++) {
    for (long long int j = 0; j < 6; j++) {
      for (long long int l = 0; l < 6; l++) {
        if (i != j && j != l && l != i) {
          if (a[i] + a[j] + a[l] == s - a[i] - a[j] - a[l])
            return cout << "YES" << '\n', 0;
        }
      }
    }
  }
  cout << "NO" << '\n';
  return 0;
}
