• + 0 comments
    import re
    
    N = int(input())
    valid_pattern = r'^[789]\d{9}'
    
    for _ in range(N):
        string = input()
        validity = re.match(valid_pattern, string)
        print('YES' if validity else 'NO')
    		
    		
    		
    		
    		I try to be as straight as possible! to be comprehensible at most