#include <bits/stdc++.h>
const int N = 100500;
const int INF = 1000000000;
const long long MOD = 1e9 + 7;
const long long p1 = 1987;
using namespace std;
long long a[11], sum;
int main() {
  for (int i = 1; i <= 6; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (sum % 2 != 0) cout << "NO", exit(0);
  sum /= 2;
  for (int i = 2; i <= 6; i++) {
    for (int j = i + 1; j <= 6; j++) {
      if (a[1] + a[i] + a[j] == sum) cout << "YES", exit(0);
    }
  }
  cout << "NO";
  return 0;
}
