#Jack Surine, Oklahoma School of Science and Mathematics

def main():

    for j in range(1, 6):

        print "Ready for test case:" + str(j)

        inpt = raw_input()

        if '.' in inpt:

            inpt = inpt[inpt.index('.')+1:]

        raw_list = inpt.split(',')

        i = 0

        t_list = []

        while i<len(raw_list):

            t_list.append((int(raw_list[i]), int(raw_list[i+1])))

            i += 2

        if (0,0) in t_list: t_list.remove((0,0))

 

        #The find_intersects method is where all the important stuff happens.

        points = find_intersects(t_list[0], t_list[1])

        for tup1 in t_list:

            for tup2 in t_list[t_list.index(tup1)+1:]:

                points = points&find_intersects(tup1, tup2)

        try: points = points - set(t_list)

        except: num = 1

        c_point = (9,9)

        for point in points:

            if point[0] < c_point[0] and point[0]>0 and point[1]>0:

                c_point = point

            elif point[0] == c_point[0] and point[1] < c_point[1] and point[1]>0:

                c_point = point

        if c_point == (9, 9): c_point = None

        if not c_point: end = 'NONE'

        else: end = str(c_point)

        print str(j) + '. ' + end

 

def find_intersects(tup1, tup2):

    l = []

    #same horizontal and vertical line checks

    if tup1[0] == tup2[0]:

        for i in range(1, 9):

            l.append((tup1[0], i))

    if tup1[1] == tup2[1]:

        for i in range(1, 9):

            l.append((i, tup1[1]))

 

    #m_tup1 = 0 and m_tup2 = undefined

    l.append((tup2[0], tup1[1]))

    #m_tup1 = undefined and m_tup2 = 0

    l.append((tup1[0], tup2[1]))

 

    #m_tup1 = -1 and m_tup2 = 1

    y = (tup1[1]+tup2[1]+tup1[0]-tup2[0])/2

    x = (tup1[0]+tup2[0]+tup1[1]-tup2[1])/2

    l.append((x,y))

    #m_tup1 = 1 and m_tup2 = -1

    y = (tup2[1]+tup1[1]+tup2[0]-tup1[0])/2

    x = (tup2[0]+tup1[0]+tup2[1]-tup1[1])/2

    l.append((x,y))

 

    #m_tup2 = 0

    x = (tup1[0]-tup1[1]+tup2[1])

    l.append((x, tup2[1]))

    x = (tup1[0]+tup1[1]-tup2[1])

    l.append((x, tup2[1]))

    #m_tup2 = undefined

    y = (tup1[1]-tup1[0]+tup2[0])

    l.append((tup2[0], y))

    y = (tup1[1]+tup1[0]-tup2[0])

    l.append((tup2[0], y))

 

    #m_tup1 = 0

    x = (tup2[0]-tup2[1]+tup1[1])

    l.append((x, tup1[1]))

    x = (tup2[0]+tup2[1]-tup1[1])

    l.append((x, tup1[1]))

    #m_tup2 = undefined

    y = (tup2[1]-tup2[0]+tup1[0])

    l.append((tup1[0], y))

    y = (tup2[1]+tup2[0]-tup1[0])

    l.append((tup1[0], y))

 

 

    #same diagonal line checks

    if (tup1[1]-tup1[0]) == (tup2[1]-tup2[0]):

        i, j = tup1[0], tup1[1]

        while i<9 and j<9:

            l.append((i,j))

            i, j = i+1, j+1

        i, j = tup1[0], tup1[1]

        while i>0 and j>0:

            l.append((i,j))

            i, j = i-1, j-1

    if (tup1[1]+tup1[0]) == (tup2[1]+tup2[0]):

        i, j = tup1[0], tup1[1]

        while i<9 and j>0:

            l.append((i,j))

            i, j = i+1, j-1

        i, j = tup1[0], tup1[1]

        while i>0 and j<9:

            l.append((i,j))

            i, j = i-1, j+1

    #remove all duplicates and return

    return set(l)

 

if __name__ == '__main__':

    main()