using System;
class Node {
public int data;
public Node next;
};
class LinkedList {
public Node head;
public LinkedList(){
head = null;
}
public void PrintList() {
Node temp = new Node();
temp = this.head;
if(temp != null) {
Console.Write("The list contains: ");
while(temp != null) {
Console.Write(temp.data + " ");
temp = temp.next;
}
Console.WriteLine();
} else {
Console.WriteLine("The list is empty.");
}
}
};
class Implementation {
static void Main(string[] args) {
LinkedList MyList = new LinkedList();
Node first = new Node();
first.data = 10;
first.next = null;
MyList.head = first;
Node second = new Node();
second.data = 20;
second.next = null;
first.next = second;
Node third = new Node();
third.data = 30;
third.next = null;
second.next = third;
MyList.PrintList();
}
}