Iroha loves _Haiku_. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.  To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.
data=list(input().split())
a=0
b=0
for i in range(0,3):
    if data[i]==5:
        a=a+1
    elif data[i]==7:
        b=b+1
if (a==1 and b==2):
    print('YES')
else:
    print('NO')
data=list(input().split())
a=0
b=0
for i in range(0,3):
    if data[i]=='5':
        a=a+1
    elif data[i]=='7':
        b=b+1
if (a==2 and b==1):
    print('YES')
else:
    print('NO')