class IntList {

    public static IntList reverse(IntList A) {
        if (A.equals(null)) {
            return A;
        }
        IntList prev, ptr, next;
        prev = A;
        ptr = prev.rest;
        prev.rest = null;
        while (ptr.rest != null) {
            next = ptr.rest;
            ptr.rest = prev;
            prev = ptr;
            ptr = next;
        }
        ptr.rest = prev;
        return ptr;
    }

    public  IntList(int first0, IntList rest0);
    public  IntList();

}