• + 0 comments
    import re
    
    N = int(input())
    for _ in range(N):
        phone_number = input().strip()
        if re.match(r'^[789]\d{9}$', phone_number):
            print("YES")
        else:
            print("NO")