import java.io.*;

public class Library {
public static void main (String[] args) {
Book_List books = new Book_List();

books.add("The Hitchhicker's Guide to the Galaxy");
books.add("Jonathan Livingston Seagull");
books.add("A Tale of Two Cities");
books.add("Java Software Solutions");

books.print();
}
}

class Book_List {
private Book list;

Book_List(){
list = null;
}

public void add (String new_title){
Book new_book = new Book (new_title);
Book current;

if(list == null)
list = new_book;
else {
current = list;
while(current.get_next() != null)
current = current.get_next();
current.set_next (new_book);
}
}

public void print(){
Book current = list;
while(current != null){
current.print();
current = current.get_next();
}
}

}

class Book {
private String title;
private Book next;

Book (String new_title){
title = new_title;
next = null;
}

public Book get_next (){
return next;
}

public void set_next(Book next_book) {
next = next_book;
}

public void print(){

System.out.println(title);
}
}