Printing required result
for i in range ( len ( answer ) ) : NEW_LINE INDENT if ( answer [ i ] [ 1 ] > - 1 ) : NEW_LINE INDENT flag = 1 NEW_LINE print ( answer [ i ] [ 0 ] , answer [ i ] [ 1 ] ) NEW_LINE DEDENT DEDENT