try:
    while 1:
        n = int(input())
        mapa = [[c for c in input()] for _ in range(n)]
        colors = mapa[0]+mapa[1]+mapa[2]
        for i in range(len(colors)):
            if colors.count(colors[i])==1:
                del colors[i]
                break
        colors=set(colors)

        for x,line in enumerate(mapa):
            for c in colors:
                if not c in line:
                    break
            if not c in line:
                break
            
        for i in range(len(mapa)):
            s=0
            for j in range(len(mapa)):
                if mapa[j][i] == c:
                    s=1
                    break
            if s==0:
                break
        print(x+1,i+1,c)
        
except :pass
