/* * 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. */// //package tribune; //import java.io.BufferedReader; import java.io.IOException; //import java.io.InputStreamReader; import java.util.Scanner; /** * * @author tym13 */ public class Tribune { //public static BufferedReader in2; /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { // TODO code application logic here //in2 = new BufferedReader(new InputStreamReader(System.in)); Scanner in = new Scanner(System.in); while(true){ int n = Integer.parseInt( in.nextLine()); String[] rady = new String[n]; for (int i = 0; i < n; i++) { rady[i] = in.nextLine(); } int suma = 0; for(int i = 1; i <= n; i++) suma = suma + i; int[] abc = new int[26]; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { int index = (int)(rady[i].charAt(j)) - 65; abc[index] = abc[index] + (i+1); } } int radka = 0; char pism = '1'; char john = '1'; for (int i = 0; i < abc.length; i++) { if (abc[i] == 3 && n == 3) { radka = 3; char pism2 = (char)(i + 65); if (rady[2].indexOf(pism2) >= 0) { john = pism2; } else { pism = pism2; } } else if (abc[i] != 0 && abc[i] != suma) { if (abc[i] > n) { pism = (char)(i + 65); } else { radka = abc[i]; john = (char)(i + 65); } } } //System.out.println(radka + " " + john + " "+ pism); int sloupec = rady[radka-1].indexOf(john) +1; System.out.println(radka + " " + sloupec + " "+ pism); } } }