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