def check_ambiguity(grammar, root, n_max=6):
    """
    Check if the grammar produces ambiguous (repeated) objects

    Args:
        grammar (dict): Grammar to check
        root: Grammar root object
        n_max (int): Max object size to check

    Returns:
        bool: Check result
    """
    for n in range(n_max):
        L = grammar[root].list(n)
        if len(L) != len(set(L)):
            return True
    return False