#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[7], i, j, k, s = 0, s1 = 0;
  for (i = 1; i <= 6; i++) {
    cin >> a[i];
    s = s + a[i];
  }
  for (i = 1; i <= 4; i++) {
    for (j = i + 1; j <= 5; j++) {
      for (k = j + 1; k <= 6; k++) {
        s1 = a[i] + a[j] + a[k];
        if (s1 * 2 == s) {
          cout << "YES" << endl;
          return 0;
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
