import sys
import re

def check_dns(s):
    if len(s) > 255: return False

    s_parts = s.split('.')
    if len(s_parts) < 2:
        return False
    
    for i in s_parts:
        if len(i) > 63: return False
        if i.startswith('-') or i.endswith('-'):
            return False
        pattern = r'^[a-zA-Z0-9-]+$'
        if not re.match(pattern, i):
            return False
    
    return True
if __name__ == "__main__":
    for line in sys.stdin:
        result = check_dns(line)
        if result:
            print("True")
        else:
            print("False")