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