#include <bits/stdc++.h>
using namespace std;
const int inf = (int)(2e9);
const long long linf = (long long)(4e18);
long long power(long long a, long long b) {
  if (b == 0) return a;
  if (b & 1) return a * power(a, b - 1);
  long long tmp = power(a, b / 2);
  return tmp * tmp;
}
void solve();
signed main() {
  std::ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}
const int maxn = (int)(1e4 + 10);
int arr[6];
void solve() {
  int sum = 0;
  for (int i = 0; i < 6; ++i) {
    cin >> arr[i];
    sum += arr[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 x = arr[i] + arr[j] + arr[k];
        if (x == sum - x) {
          cout << "YES\n";
          return;
        }
      }
    }
  }
  cout << "NO\n";
}
