• + 0 comments
    import re
    
    N = int(input())
    
    phone_number_list = [ input() for i in range(N) ]
    
    for phone_number in phone_number_list:
        if len(phone_number) == 10 and phone_number.isdigit() and re.match(r"^[789](\d)", phone_number):
            print("YES")
        else:
            print("NO")