#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[10], i, j, k, sum = 0, s, pk = 0;
  for (i = 0; i < 6; i++) {
    scanf("%d", &arr[i]);
    sum = sum + arr[i];
  }
  if (sum % 2 == 0) {
    sum = sum / 2;
    for (i = 0; i < 6; i++) {
      for (j = i + 1; j < 6; j++) {
        for (k = j + 1; k < 6; k++) {
          s = arr[i] + arr[j] + arr[k];
          if (sum == s) {
            pk = 1;
            break;
          }
        }
        if (pk == 1) break;
      }
      if (pk == 1) break;
    }
    if (pk == 1)
      printf("YES");
    else
      printf("NO");
  } else
    printf("NO");
}
