import com.mwc.util.*;
import java.io.*;

public class CListTest {
   public static void main(String args[]) { 
      CListString list = new CListString();
      list.pushBack("One");
      list.pushBack("Two");
      list.pushBack("Three");
      list.pushFront("-1");
      int i = 0;
      for(CListString.Iterator ptr = list.begin(); ptr.notEnd(); ptr.next()) {
         if(i == 0) 
            list.insertAfter(ptr, "-0.5");
         else if(i == 4)
            list.insertBefore(ptr, "2.5");
         i++;
      }
      i = 0;
      for(CListString.Iterator ptr = list.begin(); ptr.hasNext(); ptr.next()) {
         if(i == 1)
            ptr.remove();
         else if(i == 0)
            ptr.remove();
         i++;
      }
      for(CListString.Iterator ptr = list.begin(); ptr.notEnd(); ptr.next())
         System.out.println(ptr.data());
      System.out.println();
      for(CListString.Iterator ptr = list.rbegin(); ptr.notEnd(); ptr.prev())
         System.out.println(ptr.data());
   }
}