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