# lucky no codechef problem in python
for _ in range(int(input())):
a,b,c = list(map(int,input().split()))
if 7 in (a,b,c):
print('Yes')
else:
print("No")
t=int(input())
a=str(4)
for i in range(t):
x=str(input())
count=0
for j in x:
if j==a:
count=count+1
print(count)