#include <bits/stdc++.h>
const int N = 1e5 + 100, M = 1e6 + 100, SQ = sqrt(2e5), LG = 23, base = 2,
          second = 1e2 + 100;
const long long mod = 1e9 + 7, MOD = 1e9 + 9;
const long long INF = 1e9, inf = 1e18, super_inf = ~0ull / 4;
using namespace std;
int a[second], sum;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  for (int i = 1; i <= 6; i++) cin >> a[i], sum += 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] == sum - (a[i] + a[j] + a[k]))
          return cout << "YES" << endl, 0;
      }
    }
  }
  return cout << "NO" << endl, 0;
}
