Shortest path around a set of points
I assume your algorithm is correct and will comment only coding style

I would change INF = float("inf") to INF = math.inf (also you have to import it), since you use python 3.x (I'll asume you can use newest version) inf is now in math package.

Do not put any algorithms directly to the file (I am thinking about with open("input.txt") as f: and so on...) create a function - this is a good pracice because if someone would ever wanted to load your package he wouldnt like to start algorithm right away and also it helps if it comes to testing (you cannot test file but you can test a function).

Regarding a tuple construct

def vector(u, w):
    return (w[0] - u[0], w[1] - u[1])


I would love to see namedtuple here, it is kind of named tuple but it helps other programmers to see what the object exactly is and improve readibility (you would use edge.x instead of edge[0]). It also helps IDE to intelisence it. 

Regarding T = int(f.readline()):

If (and only if) you assume that input file is correct such lines are fine but if not a try-except(python's try-catch) closure would be great here. The same thing might be applied to all the parsing in your script.

Note about performance:
I cannot see any real code improvements if it comes to pure pythonic way, in my opinion if you want a faster solution you should try to come up with faster algorithm (maybe some assumptions for your set that would reduce edges to check?).