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