import java.util.*;

class VectorSort {
  static Vector insertionSort(Vector input) {
    int pos = 0;
    while (pos < input.size()) {
      int newpos = VectorSort.smallest(input, pos);
      if (newpos == -1) {
        System.out.println("Ungueltige Eingabe");
        break;
      }
      String s = (String) input.elementAt(pos);
      input.setElementAt(input.elementAt(newpos),pos);
      input.setElementAt(s, newpos);
      pos++;
    }
    Enumeration e = input.elements();
    while(e.hasMoreElements()) {
      String s = (String) e.nextElement();
    }
    return input;
  }
  static int smallest(Vector input, int start) {
    if (input == null || input.size() <= start) return -1;
    int i = start + 1;
    int small = start;
    String smallest = (String) input.elementAt(small);
    while (i != input.size()) {
      String current = (String) input.elementAt(i);
      if (current.compareTo(smallest) < 0) {
        small = i;
        smallest = (String) input.elementAt(i);
      }
      i++;
    }
    return small;
  }
  public static void main(String[] args) {
    Vector names = new Vector();
    String a = new String("Adalbert");
    String b = new String("Ziegenbert");
    String c = new String("Fruehgebert");
    names.addElement(a);
    names.addElement(b);
    names.addElement(c);
    Vector output = new Vector(VectorSort.insertionSort(names));
    Enumeration e = output.elements();
    while(e.hasMoreElements()) {
      String s = (String) e.nextElement();
      System.out.println(s);
    }
  }
}