import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;

/**
 * Created by cteam004 on 10/22/16.
 */
public class Tribune {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();

        while (line != null) {
            int count = Integer.parseInt(line);

            String[][] map = new String[count][count];
            HashMap<String, Integer> hm = new HashMap<>();
            HashMap<String, int[]> lastPos = new HashMap<>();

            for (int i = 0; i < count; i++) {
                line = br.readLine();
                map[i] = line.split("");

                for (int j = 0; j < count; j++) {
                    String string = map[i][j];
                    int[] posi = new int[2];
                    posi[0] = i + 1;
                    posi[1] = j + 1;

                    lastPos.put(string, posi);

                    if (hm.containsKey(string)) {
                        hm.put(string, hm.get(string) + 1);
                    } else {
                        hm.put(string, 1);
                    }
                }
            }

            String wrong = "";
            String correct = "";
            for (String s : hm.keySet()) {
                if (hm.get(s) < 2 || hm.get(s) > count) {
                    wrong = s;
                } else if (hm.get(s) > 1 && hm.get(s) < count) {
                    correct = s;
                }
            }

            if (hm.get(wrong) < 2) {
                int[] wrongPos = lastPos.get(wrong);
                System.out.println(wrongPos[0] + " " + wrongPos[1] + " " + correct);
            } else {
                ArrayList<Integer> row = new ArrayList<>();
                ArrayList<Integer> col = new ArrayList<>();

                int posRow = 0;
                int posCol = 0;

                for (int i = 0; i < count; i++) {
                    for (int j = 0; j < count; j++) {
                        if (wrong.equals(map[i][j])){
                            if (!row.contains(i)){
                                row.add(i);
                            } else {
                                posRow = i + 1;
                            }

                            if (!col.contains(j)){
                                col.add(j);
                            } else {
                                posCol = j + 1;
                            }
                        }
                    }
                }

                System.out.println(posRow + " " + posCol + " " + correct);
            }

            line = br.readLine();
        }
    }
}