#include <bits/stdc++.h>
using namespace std;
int a[10], l, r, sum;
int main() {
  ios ::sync_with_stdio(0), cin.tie(0);
  for (int i = 1; i <= 6; i++) cin >> a[i], sum += a[i];
  if (sum & 1) return puts("NO"), 0;
  sum /= 2;
  for (int i = 1; i <= 4; i++) {
    for (int j = i + 1; j <= 5; j++) {
      for (int k = j + 1; k <= 6; k++) {
        if (a[i] + a[j] + a[k] == sum) return puts("YES"), 0;
      }
    }
  }
  puts("NO");
  return 0;
}
