#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[6], i, j, k, b1, b2 = 0, c, sum = 0;
  for (i = 0; i < 6; i++) {
    cin >> a[i];
    sum = sum + a[i];
  }
  if (sum % 2 == 0) {
    b1 = sum / 2;
    for (i = 0; i < 4; i++) {
      for (j = i + 1; j < 5; j++) {
        for (k = j + 1; k < 6; k++) {
          c = a[i] + a[j] + a[k];
          if (c == b1) {
            b2 = 1;
            break;
          }
        }
      }
    }
    if (b2 == 1)
      cout << "YES";
    else
      cout << "NO";
  } else
    cout << "NO";
}
