try: while True: size = int(input()) field = [] for i in range(size): field.append(input()) c1, c2, c3 = set(field[0]), set(field[1]), set(field[2]) if c1 == c2: c = c1 elif c1 == c3: c = c1 else: c = c2 rev_field = list(zip(*field)) for i, row in enumerate(field): if set(row) != c: if len(set(row)) == len(c): char = list(c - set(row))[0] wrong_char = list(set(row) - c)[0] print(i+1, row.index(wrong_char)+1, char) break else: char = list(c - set(row))[0] for j, rowchar in enumerate(row): if row.count(rowchar) == rev_field[j].count(rowchar) == 2: print(i+1, j+1, list(c - set(row))[0]) break except EOFError: pass