📅  最后修改于: 2022-03-11 14:47:23.156000             🧑  作者: Mango
# Enter your code here. Read input from STDIN. Print output to STDOUT
import re
for _ in range(int(input())):
if re.match(r'[789]\d{9}$',input()):
print('YES')
else:
print('NO')