import java.util.Comparator; import java.util.Scanner; import java.util.TreeSet; public class Main { static int N; static char list[][]; public static void main(String[] args) { try (Scanner scan = new Scanner(System.in)) { N = scan.nextInt(); list = new char[N][N]; for(int i=0; i set = new TreeSet<>(Comparator.reverseOrder()); for(int j=0; j