#include <bits/stdc++.h>
using namespace std;
int a[7];
int sum;
int n;
bool ans, st[7], flag;
void dfs(int cnt) {
  if (cnt == 3) {
    if (n + n == sum) {
      ans = true;
      flag = true;
      return;
    }
  }
  for (int i = 0; i < 6; i++) {
    if (!st[i]) {
      n += a[i];
      st[i] = true;
      dfs(cnt + 1);
      if (flag) return;
      n -= a[i];
      st[i] = false;
    }
  }
}
int main(void) {
  for (int i = 0; i < 6; i++) cin >> a[i], sum += a[i];
  dfs(0);
  if (!ans)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
