#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[6];
  int s = 0;
  for (int i = 0; i < 6; i++) {
    cin >> a[i];
    s += a[i];
  }
  bool flag = false;
  for (int i = 0; i < 4; i++) {
    for (int j = i + 1; j < 5; j++) {
      for (int k = j + 1; k < 6; k++) {
        int sum = a[i] + a[j] + a[k];
        if (sum == s - sum) {
          flag = true;
          break;
        }
      }
    }
  }
  if (flag) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
