search 2d matrix Python accepted