#include <bits/stdc++.h>
using namespace std;
const double Pi = acos(-1.0);
const double EPS = 1e-9;
const int INF = 2 * 1e9;
int main() {
  ios_base::sync_with_stdio(0);
  vector<int> a(6);
  int s = 0;
  for (int i = 0; i < 6; i++) {
    cin >> a[i];
    s += a[i];
  }
  bool tmp = false;
  for (int i = 1; i < 6; i++) {
    for (int j = 1; j < 6; j++)
      if ((i != j) && ((a[0] + a[i] + a[j]) == (s - (a[0] + a[i] + a[j])))) {
        tmp = true;
        break;
      }
    if (tmp == true) break;
  }
  if (tmp == true)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
