#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[7], sum = 0;
  for (int i = 1; i <= 6; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum % 2 == 1) {
    cout << "NO";
    return 0;
  }
  sort(a + 1, a + 7);
  for (int i = 1; i <= 4; i++) {
    for (int j = i + 1; j <= 5; j++) {
      for (int k = j + 1; k <= 6; k++)
        if (a[i] + a[j] + a[k] == sum / 2) {
          cout << "YES";
          return 0;
        }
    }
  }
  cout << "NO";
  return 0;
}
