import java.util.Scanner; /* * 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. */ /** * * @author mahansky */ public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (scanner.hasNextLine()) { int rowCount = Integer.parseInt(scanner.nextLine()); String[] rows = new String[rowCount]; for (int i = 0; i < rowCount; i++) { rows[i] = scanner.nextLine(); } String good = ""; String wrong = ""; int rowIndex = 0; int colIndex = 0; if (compare(rows[0], rows[1])) { for (int i = 2; i < rowCount; i++) { if (!compare(rows[0], rows[i])) { wrong = rows[i]; rowIndex = i + 1; } } good = rows[0]; } else if (compare(rows[0], rows[2])) { wrong = rows[1]; good = rows[0]; rowIndex = 2; } else { wrong = rows[0]; good = rows[1]; rowIndex = 1; } String wrongChar = ""; for (int i = 0; i < good.length(); i++) { if (!wrong.contains("" + good.charAt(i))) { wrongChar = good.charAt(i) + ""; } } String goodChar = ""; for (int i = 0; i < wrong.length(); i++) { if (!good.contains("" + wrong.charAt(i))) { goodChar = wrong.charAt(i) + ""; colIndex = i + 1; } } System.out.println(rowIndex + " " + colIndex + " " + wrongChar); } } public static boolean compare(String a, String b) { for (int i = 0; i < a.length(); i++) { if (!b.contains("" + a.charAt(i))) { return false; } } return true; } public static String wrong(String a, String b) { for (int i = 0; i < a.length(); i++) { if (!b.contains("" + a.charAt(i))) { return "" + a.charAt(i); } } return ""; } }