import java.util.*; public final class tribune { public final static void main(String args[]) { try { Scanner s = new Scanner(System.in); while (true) { //System.out.println("READ2"); int lines = s.nextInt(); List fans = new ArrayList<>(); for (int i = 0; i < lines; ++i) { while (!s.hasNext("[a-zA-Z]*")) s.next(); String str = s.next("[a-zA-Z]*"); //System.out.println(str); for (Character c : str.toCharArray()) fans.add(c); } //System.out.println(fans.toString()); Set row = new HashSet<>(); for (int y = 0; y < lines; ++y) { char c = fans.get(y*lines+0); row.add(c); //System.out.println(c); } //System.out.println(row.toString()); boolean found = false; //System.out.println("READ"); for (int x = 1; x < lines; ++x) { for (int y = 0; y < lines; ++y) { if (!row.contains(fans.get(y*lines+x))) { //System.out.println("Expectation failed for " + fans.get(y*lines+x) + "!"); //System.out.println(row.toString()); for (int y2 = 0; y2 < lines; ++y2) { char c2 = fans.get(y2*lines+x); row.remove(c2); /* if (row.remove(c2)) System.out.println("Removed "+c2); else System.out.println("Not removed "+c2);*/ } //System.out.println (row.size()); int gotX = x; int gotY = y; char expected = row.iterator().next(); char got = fans.get(y*lines+x); //System.out.println("Expected " + expected + " got " + got ); if (x == 1) { //cout << "First" << endl; row.clear(); for (int yThird = 0; yThird < lines; ++yThird) { row.add(fans.get(yThird*lines+2)); } if (!row.contains(expected)) { //System.out.println("Didn't find expected in line 2"); for (int yFirst = 0; yFirst < lines; ++yFirst) { //System.out.println( yFirst + " got :" + fans.get(yFirst*lines)); if (fans.get(yFirst*lines) == expected) { //System.out.println ("got y "); gotY = yFirst; } } expected = got; gotX = 0; } } System.out.println((gotY+1) + " " + (gotX+1) + ' ' + expected ); found = true; break; } } if (found) break; } } } catch (NoSuchElementException e) { //e.printStackTrace(); return; } catch (Exception e) { //e.printStackTrace(); return; } } }