/*
ID: shubham147
TASK: gift1
LANG: C++14                 
*/
// #include <ext/pb_ds/assoc_container.hpp> // Common file 
// #include <ext/pb_ds/tree_policy.hpp> 
// #include <functional> // for less
#include<bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization("unroll-loops")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC optimize("fast-math")
// #pragma GCC optimize("no-stack-protector")
#define ll long long
#define f(i,a,b) for(ll i=a;i<b;i++)
#define mod 1000000007
#define mp make_pair
#define ff first
#define ss second
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define sc(a) scanf("%lld",&a)
#define pf printf
#define sz(a) (int)(a.size())
#define psf push_front
#define ppf pop_front
#define ppb pop_back
#define pb push_back
#define pq priority_queue
#define all(s) s.begin(),s.end()
#define sp(a) setprecision(a)
#define rz resize
#define ld long double
#define inf (ll)1e18
#define ub upper_bound
#define lb lower_bound
#define bs binary_search
#define eb emplace_back
const double pi = acos(-1);
ll binpow(ll a, ll b){ll res=1;while(b!=0){if(b&1)res*=a;a*=a;b>>=1;}return res;}
 
// using namespace __gnu_pbds; 
using namespace std;

int dp[15][15][15][15][15];

bool check(int a, int b, int c, int d, int e)
{
    int cnt=0,arr[]={a,b,c,d,e};
    f(i,0,5)
    {
        if(arr[i]<0)
            return 0;
        if(arr[i]==0)
            cnt++;
    }
    if(cnt>1)
        return 0;
    else
        return 1;
}

int fn(int a, int b, int c, int d, int e)
{
    if(a+b+c+d+e==1)
        return 1;
    if(check(a,b,c,d,e))
    {
        int &ans=dp[a][b][c][d][e];
        if(ans==-1)
        {
            ans=0;
            vector<int> arr={a,b,c,d,e};
            f(i,0,5)
            {
                vector<int> temp=arr;
                f(j,0,5)
                {
                    if(i==j)
                        arr[j]++;
                    else
                        arr[j]--;
                }
                ans|=fn(arr[0],arr[1],arr[2],arr[3],arr[4]);
                arr=temp;
            }
        }     
        return ans;
    }
    else
        return 0;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // freopen("gift1.in","r",stdin);
    // freopen("gift1.out","w",stdout);
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    ll t=1;
    // cin>>t;
    f(i,1,t+1)
    {   
        memset(dp,-1,sizeof(dp));
        int ans=fn(7,7,9,5,7);
        // cout<<ans<<"\n";
        if(fn(7,7,9,5,7) == 1)
            cout<<"YES\n";  
        else
            cout<<"NO\n";
    }   
}