/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.util.*; /** * * @author tym17 */ public class tribune { static String[] radky = new String[26]; static int n; /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNextInt()) { n = sc.nextInt(); int x = 0, y = 0; char navic = 'A', chybi = 'A'; sc.nextLine(); for(int i = 0; i < n; i++) { radky[i] = sc.nextLine(); } for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if((vyskytuRadek(radky[i].charAt(j), i) != 1 && vyskytuSloupec(radky[i].charAt(j), j) != 1) || vyskytu(radky[i].charAt(j)) == 1) { x = i+1; y = j+1; navic = radky[i].charAt(j); } } } for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(vyskytu(radky[i].charAt(j)) == n - 1) { chybi = radky[i].charAt(j); } } } System.out.println(x + " " + y + " " + chybi); } } static int vyskytu(char c) { int pocet = 0; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(radky[i].charAt(j) == c) { pocet++; } } } return pocet; } static int vyskytuRadek(char c, int radek) { int pocet = 0; for(int j = 0; j < n; j++) { if(radky[radek].charAt(j) == c) { pocet++; } } return pocet; } static int vyskytuSloupec(char c, int sloupec) { int pocet = 0; for(int j = 0; j < n; j++) { if(radky[j].charAt(sloupec) == c) { pocet++; } } return pocet; } }