Condition to check if there is a possible solution
if flag : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT else : NEW_LINE INDENT form = [ ' ' ] * n NEW_LINE for i in range ( n ) : NEW_LINE INDENT indi = interval [ i ] [ 2 ] NEW_LINE form [ indi ] = interval [ i ] [ 3 ] NEW_LINE DEDENT DEDENT