def sort(line):
    x0, y0, x1, y1 = line
    turn = False
    if abs(x1 - x0) > abs(y1 - y0):
        if x1 < x0:
            turn = True
    elif y1 < y0:
        turn = True
    if turn:
        return (x1, y1, x0, y0)
    return line