#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int count = 0, total = 0, sum, arr[6], i;
  for (i = 0; i < 6; i++) {
    cin >> arr[i];
    total += arr[i];
  }
  sort(arr, arr + 6);
  long long int j, k;
  for (i = 0; i < 4; i++) {
    for (j = 1; j < 5; j++) {
      for (k = 2; k < 6; k++) {
        sum = arr[i] + arr[j] + arr[k];
        if ((total - sum) == sum && i != j && i != k && j != k) {
          cout << "YES";
          count += 1;
          break;
        }
      }
      if (count == 1) break;
    }
    if (count == 1) break;
  }
  if (count == 0) cout << "NO";
}
