def two_2d_number_of_points(points):
    """
    Find the number of points collected by 2 people in a 2D grid
    Complexity: O(N^2)

    In that problem we have 2 persons beginning from (0, 0) and (n, 0), they
    can meet only once and we have to find the maximum points collected by both
    without taking in account the meeting place. We consider in this problem

    Person1:                            Person2:
    (i,j-1)-->(i,j)-->(i,j+1)           (i,j-1)-->(i,j)-->(i,j+1)
    (i,j-1)-->(i,j)-->(i+1,j)           (i,j-1)-->(i,j)-->(i-1,j)
    (i-1,j)-->(i,j)-->(i,j+1)           (i+1,j)-->(i,j)-->(i,j+1)
    (i-1,j)-->(i,j)-->(i+1,j)           (i+1,j)-->(i,j)-->(i-1,j)

    Meeting:
    1) (i,j-1)-->(i,j)-->(i,j+1) and (i+1,j)-->(i,j)-->(i-1,j)
    2) (i-1,j)-->(i,j)-->(i+1,j) and (i,j-1)-->(i,j)-->(i,j+1)
    """
    n = 3
    m = 3

    # We allocate more space so that we can avoid wasting "for" loops for the first initialization.
    p1_start = [[0 for _ in range(m+2)] for _ in range(n+2)]
    p1_end = [[0 for _ in range(m+2)] for _ in range(n+2)]

    p2_start = [[0 for _ in range(m+2)] for _ in range(n+2)]
    p2_end = [[0 for _ in range(m+2)] for _ in range(n+2)]

    # Person1 start to end.
    for i in range(1, n+1):
        for j in range(1, m+1):
            p1_start[i][j] = max(p1_start[i-1][j], p1_start[i][j-1]) + points[i-1][j-1]

    # Person1 end to start.
    for i in range(n, 0, -1):
        for j in range(m, 0, -1):
            p1_end[i][j] = max(p1_end[i+1][j], p1_end[i][j+1]) + points[i-1][j-1]

    # Person2 start to end.
    for i in range(n, 0, -1):
        for j in range(1, m+1):
            p2_start[i][j] = max(p2_start[i+1][j], p2_start[i][j-1]) + points[i-1][j-1]

    # Person2 end to start.
    for i in range(1, n+1):
        for j in range(m, 0, -1):
            p2_end[i][j] = max(p2_end[i-1][j], p2_end[i][j+1]) + points[i-1][j-1]

    # We use both person1 arrays and both person2 arrays to not take in account the meeting point.
    # The meeting cell can range from 2 <= i <= n-1 and 2 <= j <= m-1.
    # We consider every point to be a meeting point.
    ans = 0
    for i in range(2, n):
        for j in range(2, m):
            op1 = p1_start[i][j-1] + p1_end[i][j+1] + p2_start[i+1][j] + p2_end[i-1][j]
            op2 = p1_start[i-1][j] + p1_end[i+1][j] + p2_start[i][j-1] + p2_end[i][j+1]
            ans = max(ans, max(op1, op2))

    return ans