• + 0 comments

    n = int(input()) # Read number of test cases

    for i in range(n):

    ph_no = input()  # Read each mobile number
    
    if len(ph_no) == 10 and ph_no[0] in ['7', '8', '9'] and ph_no.isdigit():
        print("YES")
    else:
        print("NO")