#include <bits/stdc++.h>
using namespace std;
bool chk(int a, int b, int c, int sum) { return a + b + c == sum; }
int main() {
  int sum = 0;
  vector<int> u(6);
  for (int i = 0; i < 6; i++) {
    cin >> u[i];
    sum += u[i];
  }
  if (sum % 2) {
    cout << "NO";
    return 0;
  }
  sum /= 2;
  for (int a = 0; a < 6; a++)
    for (int b = 0; b < 6; b++)
      for (int c = 0; c < 6; c++)
        if (a != b && b != c && a != c && u[a] + u[b] + u[c] == sum) {
          cout << "YES";
          return 0;
        }
  cout << "NO";
  return 0;
}
