/*
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";
}
}
LyoKSUQ6IHNodWJoYW0xNDcKVEFTSzogZ2lmdDEKTEFORzogQysrMTQgICAgICAgICAgICAgICAgIAoqLwovLyAjaW5jbHVkZSA8ZXh0L3BiX2RzL2Fzc29jX2NvbnRhaW5lci5ocHA+IC8vIENvbW1vbiBmaWxlIAovLyAjaW5jbHVkZSA8ZXh0L3BiX2RzL3RyZWVfcG9saWN5LmhwcD4gCi8vICNpbmNsdWRlIDxmdW5jdGlvbmFsPiAvLyBmb3IgbGVzcwojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgovLyAjcHJhZ21hIEdDQyBvcHRpbWl6ZSgiT2Zhc3QiKQovLyAjcHJhZ21hIEdDQyB0YXJnZXQoImF2eCxhdngyLGZtYSIpCi8vICNwcmFnbWEgR0NDIG9wdGltaXphdGlvbigidW5yb2xsLWxvb3BzIikKLy8gI3ByYWdtYSBHQ0Mgb3B0aW1pemUoInVucm9sbC1sb29wcyIpCi8vICNwcmFnbWEgR0NDIG9wdGltaXplKCJmYXN0LW1hdGgiKQovLyAjcHJhZ21hIEdDQyBvcHRpbWl6ZSgibm8tc3RhY2stcHJvdGVjdG9yIikKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBmKGksYSxiKSBmb3IobGwgaT1hO2k8YjtpKyspCiNkZWZpbmUgbW9kIDEwMDAwMDAwMDcKI2RlZmluZSBtcCBtYWtlX3BhaXIKI2RlZmluZSBmZiBmaXJzdAojZGVmaW5lIHNzIHNlY29uZAojZGVmaW5lIHJmKGksYSxiKSBmb3IobGwgaT1hO2k+PWI7aS0tKQojZGVmaW5lIHNjKGEpIHNjYW5mKCIlbGxkI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TsKfQoKaW50IGZuKGludCBhLCBpbnQgYiwgaW50IGMsIGludCBkLCBpbnQgZSkKewogICAgaWYoYStiK2MrZCtlPT0xKQogICAgICAgIHJldHVybiAxOwogICAgaWYoY2hlY2soYSxiLGMsZCxlKSkKICAgIHsKICAgICAgICBpbnQgJmFucz1kcFthXVtiXVtjXVtkXVtlXTsKICAgICAgICBpZihhbnM9PS0xKQogICAgICAgIHsKICAgICAgICAgICAgYW5zPTA7CiAgICAgICAgICAgIHZlY3RvcjxpbnQ+IGFycj17YSxiLGMsZCxlfTsKICAgICAgICAgICAgZihpLDAsNSkKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdmVjdG9yPGludD4gdGVtcD1hcnI7CiAgICAgICAgICAgICAgICBmKGosMCw1KQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGlmKGk9PWopCiAgICAgICAgICAgICAgICAgICAgICAgIGFycltqXSsrOwogICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgYXJyW2pdLS07CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBhbnN8PWZuKGFyclswXSxhcnJbMV0sYXJyWzJdLGFyclszXSxhcnJbNF0pOwogICAgICAgICAgICAgICAgYXJyPXRlbXA7CiAgICAgICAgICAgIH0KICAgICAgICB9ICAgICAKICAgICAgICByZXR1cm4gYW5zOwogICAgfQogICAgZWxzZQogICAgICAgIHJldHVybiAwOwp9CgppbnQgbWFpbigpCnsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOwogICAgY2luLnRpZShOVUxMKTsKICAgIC8vIGZyZW9wZW4oImdpZnQxLmluIiwiciIsc3RkaW4pOwogICAgLy8gZnJlb3BlbigiZ2lmdDEub3V0IiwidyIsc3Rkb3V0KTsKI2lmbmRlZiBPTkxJTkVfSlVER0UKICAgIGZyZW9wZW4oImlucHV0LnR4dCIsInIiLHN0ZGluKTsKICAgIGZyZW9wZW4oIm91dHB1dC50eHQiLCJ3IixzdGRvdXQpOwojZW5kaWYKICAgIGxsIHQ9MTsKICAgIC8vIGNpbj4+dDsKICAgIGYoaSwxLHQrMSkKICAgIHsgICAKICAgICAgICBtZW1zZXQoZHAsLTEsc2l6ZW9mKGRwKSk7CiAgICAgICAgaW50IGFucz1mbig3LDcsOSw1LDcpOwogICAgICAgIC8vIGNvdXQ8PGFuczw8IlxuIjsKICAgICAgICBpZihmbig3LDcsOSw1LDcpID09IDEpCiAgICAgICAgICAgIGNvdXQ8PCJZRVNcbiI7ICAKICAgICAgICBlbHNlCiAgICAgICAgICAgIGNvdXQ8PCJOT1xuIjsKICAgIH0gICAKfQ==