import java.util.*;
public class LastLetterComparator implements Comparator {
	public int compare(Object o1, Object o2) {
		String s1 = ((String) o1).toLowerCase();
		String s2 = ((String) o2).toLowerCase();
		char c1 = s1.charAt(s1.length() -1);
		char c2 = s2.charAt(s2.length() -1);
		if (c1 > c2) return 1;
		if (c2 > c1) return -1;
		if (c1 == c2) return 0;
		else throw new InternalError();
	}
}
