#include <bits/stdc++.h>
using namespace std;
int a[7], cnt;
int main() {
  for (int i = 1; i <= 6; i++) cin >> a[i], cnt += a[i];
  for (int i = 1; i <= 6; i++)
    for (int j = i + 1; j <= 6; j++)
      for (int k = j + 1; k <= 6; k++)
        if ((a[i] + a[j] + a[k]) * 2 == cnt) {
          cout << "YES";
          return 0;
        }
  cout << "NO";
  return 0;
}
