• + 0 comments
    import re
    check = re.compile(r'^[789]\d{9}$')
    N = int(input())
    while N > 0:
        N -= 1
        print('YES' if check.match(input()) else 'NO')