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