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