#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[6];
  int S = 0;
  for (int i = 0; i < 6; i++) {
    cin >> a[i];
    S += a[i];
  }
  int good = 0;
  if (S % 2 != 0) {
    cout << "NO";
    return 0;
  } else
    for (int i = 0; i < 6; i++)
      for (int j = 1; j < 6; j++)
        for (int k = 2; k < 6; k++) {
          if (i == k || i == j || j == k) continue;
          if (a[i] + a[j] + a[k] == S / 2) {
            cout << "YES";
            return 0;
          }
        }
  cout << "NO";
  return 0;
}
