#include <bits/stdc++.h>
int ans[2];
int main() {
  int a[6];
  int i, first, last, sum = 0, j;
  for (i = 0; i < 6; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  for (i = 1; i < 5; i++) {
    for (j = i + 1; j < 6; j++) {
      ans[0] = a[0] + a[i] + a[j];
      ans[1] = sum - ans[0];
      if (ans[1] == ans[0]) {
        printf("YES\n");
        return 0;
      }
    }
  }
  printf("NO\n");
  return 0;
}
