class Link
{
class Node
{
private String name;
private Link next;
public Node(String name)
{
this.name=name;
}
public void addNode(Node newNode)
{
if(this.next==null)
{
this.next=newNode;
}
else
{
this.next.addNode(newNode);
}
}
public void printNode()
{
System.out.println(this.name);
if(this.next!=null)
{
class Node
{
private String name;
private Link next;
public Node(String name)
{
this.name=name;
}
public void addNode(Node newNode)
{
if(this.next==null)
{
this.next=newNode;
}
else
{
this.next.addNode(newNode);
}
}
public void printNode()
{
System.out.println(this.name);
if(this.next!=null)