#include <bits/stdc++.h>
using namespace std;
const int MN = 1e5 + 5;
const long long oo = 1e18;
int a[7];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int sum = 0;
  for (int i = 1; i <= 6; ++i) cin >> a[i], sum += a[i];
  sort(a + 1, a + 1 + 6);
  if (sum & 1) {
    puts("NO");
    return 0;
  }
  int tmp;
  for (int i = 1; i < 6; ++i) {
    tmp = a[i];
    for (int j = i + 1; j < 6; ++j) {
      tmp += a[j];
      for (int k = j + 1; k <= 6; ++k) {
        tmp += a[k];
        if (tmp == sum / 2) {
          puts("YES");
          return 0;
        }
        tmp -= a[k];
      }
      tmp -= a[j];
    }
  }
  puts("NO");
  return 0;
}
