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