Input Format
You do not need to read any input from stdin. The following input is handled by the locked stub code and passed to the removeDuplicates function:
The first line contains an integer, , the number of nodes to be inserted.
The  subsequent lines each contain an integer describing the  value of a node being inserted at the list's tail.
Constraints
• The data elements of the linked list argument will always be in non-decreasing order.
Output Format
Your removeDuplicates function should return the head of the updated linked list. The locked stub code in your editor will print the returned list to stdout.

### Problem solution in Java programming language.

public static Node removeDuplicates(Node head) {
// Empty list case:
}

while (current.next != null) {
// If data is equal, reset the next pointer
if (current.data == (current.next).data) {
current.next = (current.next).next;
} else {
// If data is not equal, go
// to the next element
current = current.next;
}
}

}

#### Second solution

public static Node removeDuplicates(Node head) {
// if head is null or list only has 1 element
}

// if list is more than 2 elements
while( current != null ){
// If current is a duplicate of previous
if( previous.data == current.data ){
// set previous' next pointer to skip over current node
previous.next = current.next;
// set current to next node in list, previous should not move
current = current.next;
}
else{ // node is not duplicate of previous
previous = current;
current = current.next;
}
}
}

#### Third solution

public static Node removeDuplicates(Node head) {
// if head is null or list only has 1 element
}

// if list is more than 2 elements
while( current.next != null ){
// If current is a duplicate of previous
if( current.data == current.next.data ){
// set previous' next pointer to skip over current node
current.next = current.next.next;
}
else{ // node is not duplicate of previous
current = current.next;
}
}
}

### Problem solution in Python programming language.

class Node:
def __init__(self,data):
self.data = data
self.next = None
class Solution:
p = Node(data)
else:
while(start.next!=None):
start=start.next
start.next=p
while current:
print(current.data,end=' ')
current = current.next

qu = []
return
qu.append(p.data)
p = p.next
while p is not None:
qu.append(p.data)
p = p.next
qu = list(dict.fromkeys(qu))
for item in qu:
print(item,end=' ')

mylistSolution()
T=int(input())