import java.util.Arrays;
import java.util.TreeSet;
public class Main {
public static void main(String args[]) throws Exception {
String elements[] = { "A", "C", "D", "G", "F" };
TreeSet set = new TreeSet(Arrays.asList(elements));
System.out.println(set.headSet("D"));
System.out.println(set.tailSet(""));
}
}