#include <bits/stdc++.h>
using namespace std;
int main() {
  int s = 0;
  int ar[7];
  for (int i = 1; i <= 6; i++) {
    scanf("%d", &ar[i]);
    s = s + ar[i];
  }
  for (int i = 1; i <= 6; i++) {
    if (ar[i] > s / 2) {
      printf("NO");
      return 0;
    }
  }
  if (s % 2 != 0) {
    printf("NO");
    return 0;
  }
  int p = s / 2;
  for (int j = 1; j <= 6; j++) {
    for (int i = j + 1; i <= 6; i++) {
      int q = ar[j] + ar[i];
      for (int k = i + 1; k <= 6; k++) {
        if (q + ar[k] == p) {
          printf("YES");
          return 0;
        }
      }
    }
  }
  printf("NO");
  return 0;
}
