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