#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[7];
  int sum = 0;
  for (int i = 1; i <= 6; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  int flag = 1;
  for (int i = 1; flag && i <= 4; i++)
    for (int j = i + 1; flag && j <= 5; j++)
      for (int k = j + 1; k <= 6; k++)
        if (a[i] + a[j] + a[k] == sum - (a[i] + a[j] + a[k])) {
          flag = 0;
          printf("YES\n");
          break;
        }
  if (flag) printf("NO\n");
  return 0;
}
