easily understandable code
\nclass Solution(object):\n    def nearestValidPoint(self, x, y, points):\n        """\n        :type x: int\n        :type y: int\n        :type points: List[L
```\nclass Solution(object):\n    def nearestValidPoint(self, x, y, points):\n        """\n        :type x: int\n        :type y: int\n        :type points: List[List[int]]\n        :rtype: int\n        """\n        \n        \n        mdist=float(\'inf\')#assigning a large value to the manhattan distance\n        index=-1#starting with index -1 because if we are not able to find any point then we can return -1 as mentioned in the question\n        #after that we are going through each point\n        for i in range(len(points)):\n            if points[i][0] ==x or points[i][1]==y:#checking the condition to satisfy the manhattan conditions\n                num=abs(points[i][0]-x)+abs(points[i][1]-y)#calculating the manhattan distance\n                if num<mdist:\n                    mdist=num#if we are able to find any distance then updating it\n                    index=i#we are also storing its index also as we have to return it \n        return index\n        \n```
['Python']