import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; /* * 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 cteam071 */ public class Tribune { public static BufferedReader in; public static void main(String[] args) throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); String result = ""; int teams; String line; Map map; while ((line = in.readLine()) != null) { map = new HashMap<>(); teams = Integer.parseInt(line); int firstindexjohn = 0; int lastindexjohn = 0; int rowjohn = 0; String john = ""; String seats = ""; char[][] rows = new char[teams][teams]; int row = 0; for (int i = 0; i < teams; i++) { seats = in.readLine(); for(int j = 0; j < seats.length(); j++){ String s = String.valueOf(seats.charAt(j)); if (map.containsKey(s)){ map.replace(s, map.get(s)+1); } else { map.put(s, 1); } int firstindex = seats.indexOf(seats.charAt(j)); int lastindex = seats.lastIndexOf(seats.charAt(j)); if(firstindex != lastindex){ firstindexjohn = firstindex; lastindexjohn = lastindex; rowjohn = row; john = String.valueOf(seats.charAt(firstindex)); } rows[row][j] = seats.charAt(j); } row++; } String correctteam = ""; if(!john.equals("")){ for(int a = 0; a