Check if current permutation is valid
if ( l == r ) : NEW_LINE INDENT if " AB " not in ' ' . join ( str ) : NEW_LINE INDENT print ( ' ' . join ( str ) , end = " ▁ " ) NEW_LINE DEDENT return NEW_LINE DEDENT