#include <bits/stdc++.h>
int main() {
  int i, j, k, s = 0, ss = 0, n;
  int a[6];
  for (i = 0; i < 6; i++) {
    scanf("%d", &a[i]);
    s += a[i];
  }
  for (i = 0; i < 6 - 2; i++) {
    for (j = i + 1; j < 6 - 1; j++) {
      for (k = j + 1; k < 6; k++) {
        if ((a[i] + a[j] + a[k]) * 2 == s) {
          ss = 1;
          break;
        }
      }
    }
  }
  if (ss)
    printf("YES");
  else
    printf("NO");
}
