
    Write a function to determine if a delivery route pattern number represents alternating high and low traffic segments, where consecutive digits must strictly alternate between two distinct values to be considered valid. For example, a route pattern of 121 or 343 would be valid as they show consistent alternating traffic levels, while 122 or 123 would be invalid.
    

    
def is_undulating(n):
    """
    Write a function to determine if a delivery route pattern number represents alternating high and low traffic segments, where consecutive digits must strictly alternate between two distinct values to be considered valid. For example, a route pattern of 121 or 343 would be valid as they show consistent alternating traffic levels, while 122 or 123 would be invalid.
    

    """
def is_undulating(n):
    """
    Write a function to determine if a delivery route pattern number represents alternating high and low traffic segments, where consecutive digits must strictly alternate between two distinct values to be considered valid. For example, a route pattern of 121 or 343 would be valid as they show consistent alternating traffic levels, while 122 or 123 would be invalid.
    

    """
    n = str(n)
    if len(n) <= 2:
        return False
    for i in range(2, len(n)):
        if n[i - 2] != n[i]:
            return False
    return True