import java.util.LinkedList;

        // An implementation of a FIFO queue of objects.
class Queue {
        // Add to the queue.
    public void add(Object c){
        // Add it to the end.
        getQueue().add(c);
    }

        // Remove (and return) the next from the queue.
    public Object next(){
        if(size() > 0){
            return getQueue().removeFirst();
        }
        else{
            return null;
        }
    }

        // Return (but don't remove) the next from the queue.
    public Object peek(){
        if(size() > 0){
            return getQueue().getFirst();
        }
        else{
            return null;
        }
    }

        // How many in the queue?
    public int size(){
        return getQueue().size();
    }

        // Return an array of the queue's elements. This is not
        // strictly a Queue method.
    public Object[] toArray(Object[] arr){
        return getQueue().toArray(arr);
    }

    // Return a reference to the collection.
    private LinkedList getQueue(){
        return queue;
    }

    // The collection of objects.
    private LinkedList queue = new LinkedList();
}
