Storing the cell value and cell indices in a vector .
x = [ ] NEW_LINE for i in range ( N ) : NEW_LINE INDENT for j in range ( M ) : NEW_LINE INDENT x . append ( [ adj [ i ] [ j ] , [ i , j ] ] ) NEW_LINE DEDENT DEDENT