#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(6);
  int s = 0;
  for (int i = 0; i < 6; i++) {
    cin >> a[i];
    s += a[i];
  }
  if (s % 2 != 0) {
    cout << "NO";
    return 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 (s / 2 == a[i] + a[j] + a[k]) {
          cout << "YES";
          return 0;
        }
  cout << "NO";
  return 0;
}
