#include <bits/stdc++.h>
using namespace std;
vector<long long> a;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  a = vector<long long>(6);
  int total = 0;
  for (int i = 0; i < 6; i++) {
    cin >> a[i];
    total += a[i];
  }
  for (int i = 0; i < 6; i++) {
    for (int j = i + 1; j < 6; j++) {
      for (int k = j + 1; k < 6; k++) {
        int sum = a[i] + a[j] + a[k];
        if (sum == total - sum) {
          cout << "YES" << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
