Storing Indexes of y in P , Q
for i in range ( m ) : NEW_LINE INDENT for j in range ( n ) : NEW_LINE INDENT if li [ i ] [ j ] == x : NEW_LINE INDENT I , J = i , j NEW_LINE DEDENT if li [ i ] [ j ] == y : NEW_LINE INDENT P , Q = i , j NEW_LINE DEDENT DEDENT DEDENT