#include <bits/stdc++.h>
using namespace std;
void solve() {
  vector<int> a(6);
  for (int i = 0; i < 6; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < 6; i++) {
    for (int j = i + 1; j < 6; j++) {
      for (int k = j + 1; k < 6; k++) {
        int temp = a[i] + a[j] + a[k];
        int sum = 0;
        for (int t = 0; t < 6; t++) {
          if (t == i || t == j || t == k) continue;
          sum += a[t];
        }
        if (temp == sum) {
          cout << "YES"
               << "\n";
          return;
        }
      }
    }
  }
  cout << "NO"
       << "\n";
}
void test() {}
int main() {
  test();
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
