Storing valid dimensions as for every ( x , y ) both ( x , y ) and ( y , x ) are valid
for i in range ( K ) : NEW_LINE INDENT ok [ dimensions [ i ] [ 0 ] ] [ dimensions [ i ] [ 1 ] ] = 1 NEW_LINE ok [ dimensions [ i ] [ 1 ] ] [ dimensions [ i ] [ 0 ] ] = 1 NEW_LINE DEDENT