#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(17);
  long long int a[6], sum = 0, add = 0, num = 0, sum2 = 0, c = 0;
  for (long long int i = 0; i < 6; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum % 2 != 0) {
    cout << "NO";
  } else {
    num = sum / 2;
    for (long long int i = 0; i < 6; i++) {
      for (long long int j = i + 1; j < 6; j++) {
        for (long long int k = j + 1; k < 6; k++) {
          if (num == (a[i] + a[j] + a[k])) {
            cout << "YES";
            c = 1;
            break;
          }
        }
        if (c == 1) break;
      }
      if (c == 1) break;
    }
    if (c == 0) cout << "NO";
  }
}
