Given a linked list, the task is to move all 0s to the front of the linked list. The order of all another element except 0 should be same after rearrangement. 
Example 1:
Input:  0 -> 4 -> 0 -> 5 -> 0
Output: 0 -> 0 -> 0 -> 4 -> 5
Explanation: After moving all 0s of the given
list to the front, the list is:
0 -> 0 -> 0 -> 4 -> 5
Example 2:
Input: 0 -> 1 -> 0 -> 1 -> 2
Output: 0 -> 0 -> 1 -> 1 -> 2
Your Task:
You don't need to read input or print anything. Your task is to complete the function moveZeroes() which takes head node of the linked list as input parameter.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)
Constraints:
1 <= N <= 50

Difficulty: EASY
Tags: Data structures
Skill types: Data structures
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3



# Linked List Node Structure



'''class Node: 

   

    # Function to initialize the node object 

    def __init__(self, data): 

        self.data = data 

        self.next = None  '''

class Node: 

   

    # Function to initialize the node object 

    def __init__(self, data): 

        self.data = data  # Assign data 

        self.next = None  # Initialize  

                          # next as null 

   

# Linked List class 

class LinkedList: 

     

    # Function to initialize the Linked  

    # List object 

    def __init__(self):  

        self.head = None

  

    def push(self, val):

  

    # 1 & 2: Allocate the Node & 

    #        Put in the data 

        new_node = Node(val) 

          

    # 3. Make next of new Node as head 

        new_node.next = self.head 

          

    # 4. Move the head to point to new Node  

        self.head = new_node 

    

    def moveZeroes(self):

        #code here

    def display(self):

        temp=self.head

        while(temp is not None):

            print(temp.data,end=" ")

            temp=temp.next

Solutions:
class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		k = self.head
		while k and k.next:
			if k.next.data == 0:
				self.push(0)
				if k.next.next:
					k.next = k.next.next
				else:
					k.next = None
			else:
				k = k.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		(zero, nzero) = (None, None)
		(zt, nzt) = (None, None)
		curr = self.head
		while curr:
			if curr.data == 0:
				if zero == None:
					(zero, zt) = (curr, curr)
				else:
					zt.next = curr
					zt = curr
			elif nzero == None:
				(nzt, nzero) = (curr, curr)
			else:
				nzt.next = curr
				nzt = curr
			curr = curr.next
		if zero:
			self.head = zero
			zt.next = nzero
		else:
			self.head = nzero
		if nzt:
			nzt.next = None

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		prev = self.head
		cur = self.head.next
		while cur != None:
			if cur.data == 0:
				prev.next = cur.next
				cur.next = self.head
				self.head = cur
				cur = prev.next
			else:
				prev = cur
				cur = cur.next
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		ll = []
		c = 0
		s = self.head
		while s:
			if s.data:
				ll.append(s.data)
			else:
				c += 1
			s = s.next
		s = self.head
		while c:
			s.data = 0
			s = s.next
			c -= 1
		while s:
			s.data = ll.pop(0)
			s = s.next
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		if self.head.next:
			checkNode = self.head
			while checkNode.data == 0:
				checkNode = checkNode.next
			stack = [checkNode]
			lastNode = checkNode
			while len(stack) > 0:
				current = stack.pop()
				if current.next:
					if current.data == 0:
						LinkedList.push(self, current.data)
						lastNode.next = current.next
					else:
						lastNode = current
					stack.append(current.next)
				elif current.data == 0:
					LinkedList.push(self, current.data)
					lastNode.next = current.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		num = 0
		curr = self.head
		prev = None
		while curr:
			if curr.data == 0:
				num += 1
				if not prev:
					self.head = self.head.next
					curr = self.head
				else:
					prev.next = curr.next
					curr = prev.next
			else:
				prev = curr
				curr = curr.next
		for i in range(num):
			self.push(0)

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		count = 0
		start = Node(0)
		start.next = self.head
		head = start
		while head.next:
			if head.next.data == 0:
				count += 1
				head.next = head.next.next
			else:
				head = head.next
		lista = start.next
		head = start
		for _ in range(count):
			head.next = Node(0)
			head = head.next
		head.next = lista
		self.head = start.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		t = self.head
		c = 0
		l = []
		while t:
			l.append(t.data)
			t = t.next
		c = l.count(0)
		while 0 in l:
			l.remove(0)
		l1 = [0] * c
		for i in l:
			l1.append(i)
		l1.reverse()
		self.head = Node(l1[0])
		l1.remove(l1[0])
		for item in l1:
			node = Node(item)
			node.next = self.head
			self.head = node

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		temp = self.head
		m = []
		while temp:
			if temp.data == 0:
				m.insert(0, temp.data)
			else:
				m.append(temp.data)
			temp = temp.next
		temp = self.head
		for i in m:
			temp.data = i
			temp = temp.next
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		if self.head.next == None:
			pass
		else:
			zero = None
			odd = None
			cur = self.head
			while cur:
				if cur.data == 0:
					if zero == None:
						zero = cur
						re = zero
					else:
						zero.next = cur
						zero = zero.next
				elif odd == None:
					odd = cur
					res = odd
				else:
					odd.next = cur
					odd = odd.next
				cur = cur.next
			if zero == None:
				self.head = res
			elif res == None:
				self.head = re
			else:
				odd.next = None
				zero.next = res
				self.head = re

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		tmp = self.head
		b = []
		c = []
		while tmp != None:
			if tmp.data == 0:
				c.append(tmp.data)
			else:
				b.append(tmp.data)
			tmp = tmp.next
		tmp = self.head
		for i in c:
			tmp.data = i
			tmp = tmp.next
		for i in b:
			tmp.data = i
			tmp = tmp.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		if self.head is None:
			return
		temp = self.head.next
		prev = self.head
		while temp is not None:
			if temp.data == 0:
				curr = temp
				temp = temp.next
				prev.next = temp
				curr.next = self.head
				self.head = curr
			else:
				prev = temp
				temp = temp.next
		return

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next
if __name__ == '__main__':
	t = int(input())
	for i in range(t):
		lis = LinkedList()
		n = int(input())
		arr = list(map(int, input().strip().split()))
		arr.reverse()
		for i in range(0, len(arr)):
			lis.push(arr[i])
		lis.moveZeroes()
		lis.display()


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		head = self.head
		zero = 0
		while head.next:
			if head.next.data == 0:
				zero += 1
				head.next = head.next.next
			else:
				head = head.next
		while zero:
			new = Node(0)
			new.next = self.head
			self.head = new
			zero -= 1
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		n = self.head
		p = None
		headp = None
		q = None
		headq = None
		while n != None:
			if n.data == 0:
				if p == None:
					p = n
					headp = n
				else:
					p.next = n
					p = p.next
			elif q == None:
				q = n
				headq = n
			else:
				q.next = n
				q = q.next
			n = n.next
		if headp != None and headq != None:
			p.next = headq
			q.next = None
			self.head = headp
		elif headp != None and headq == None:
			p.next = None
			self.head = headp
		else:
			q.next = None
			self.head = headq

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		arr = []
		cur = self.head
		count = 0
		while cur:
			if cur.data == 0:
				count += 1
			else:
				arr.append(cur.data)
			cur = cur.next
		cur = self.head
		i = 0
		j = 0
		while cur:
			if i < count:
				cur.data = 0
				i += 1
			else:
				cur.data = arr[j]
				j += 1
			cur = cur.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		cur = self.head
		x = []
		z = []
		while cur:
			a = cur.data
			if a != 0:
				x.append(a)
			else:
				z.append(a)
			cur = cur.next
		temp = self.head
		for i in x:
			z.append(i)
		for i in z:
			temp.data = i
			temp = temp.next
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next
		return None


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		head = self.head
		newstart = head
		prev = None
		isAnythingElse = 0
		while head:
			temp = head
			if temp.data == 0:
				if isAnythingElse == 1:
					after = head.next
					prev.next = after
					new = Node(0)
					new.next = newstart
					newstart = new
				else:
					prev = head
			else:
				isAnythingElse = 1
				prev = head
			head = head.next
		self.head = newstart

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		temp1 = self.head
		temp2 = self.head
		l0 = []
		l1 = []
		while temp1:
			if temp1.data == 0:
				l0.append(0)
			else:
				l1.append(temp1.data)
			temp1 = temp1.next
		l = l0 + l1
		for item in l:
			temp2.data = item
			temp2 = temp2.next
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		t = self.head
		num = []
		num1 = []
		while t:
			if t.data == 0:
				num.append(0)
			else:
				num1.append(t.data)
			t = t.next
		num2 = num + num1
		temp = self.head
		i = 0
		while temp:
			temp.data = num2[i]
			i += 1
			temp = temp.next
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		new_node = self.head
		res = Node(-1)
		res1 = Node(-1)
		tail = res
		tail1 = res1
		curr = new_node
		while curr:
			if curr.data == 0:
				tail.next = curr
				curr = curr.next
				tail = tail.next
			else:
				tail1.next = curr
				curr = curr.next
				tail1 = tail1.next
		tail.next = res1.next
		tail1.next = None
		self.head = res.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		k = self.head
		p = []
		l = []
		while k:
			if k.data == 0:
				p.append(k.data)
			else:
				l.append(k.data)
			k = k.next
		j = p + l
		temp = self.head
		i = 0
		while temp != None:
			temp.data = j[i]
			i += 1
			temp = temp.next
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		if self.head is None or self.head.next is None:
			return self.head
		t = self.head.next
		p = self.head
		while t:
			if t.data != 0:
				p = t
				t = t.next
			elif p.data == 0:
				p = p.next
				t = t.next
			else:
				p.next = t.next
				t.next = self.head
				self.head = t
				t = p.next
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		t = self.head
		c = 0
		l = []
		while t:
			if t.data == 0:
				c += 1
			else:
				l.append(t.data)
			t = t.next
		t = self.head
		for i in range(c):
			t.data = 0
			t = t.next
		for i in l:
			t.data = i
			t = t.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		ele = []
		count = 0
		itr = self.head
		while itr:
			if itr.data == 0:
				count += 1
			else:
				ele.append(itr.data)
			itr = itr.next
		ele.reverse()
		self.head = None
		for elements in ele:
			self.push(elements)
		for i in range(count):
			self.push(0)

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		cur = self.head
		startzero = None
		endzero = None
		startno = None
		endno = None
		while cur:
			if cur.data == 0:
				if startzero == None:
					startzero = cur
					endzero = startzero
				else:
					endzero.next = cur
					endzero = cur
			elif startno == None:
				startno = cur
				endno = startno
			else:
				endno.next = cur
				endno = cur
			cur = cur.next
		if endzero != None:
			self.head = startzero
			endzero.next = startno
		if endno != None:
			endno.next = None
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next
if __name__ == '__main__':
	t = int(input())
	for i in range(t):
		lis = LinkedList()
		n = int(input())
		arr = list(map(int, input().strip().split()))
		arr.reverse()
		for i in range(0, len(arr)):
			lis.push(arr[i])
		lis.moveZeroes()
		lis.display()
		print()


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		nodes = []
		temp = self.head
		zero_nodes_count = 0
		while temp != None:
			if temp.data == 0:
				zero_nodes_count += 1
			else:
				nodes.append(temp)
			temp = temp.next
		nodes.reverse()
		self.head = None
		for node in nodes:
			self.push(node.data)
		for _ in range(zero_nodes_count):
			self.push(0)

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next
if __name__ == '__main__':
	t = int(input())
	for i in range(t):
		lis = LinkedList()
		n = int(input())
		arr = list(map(int, input().strip().split()))
		arr.reverse()
		for i in range(0, len(arr)):
			lis.push(arr[i])
		lis.moveZeroes()
		lis.display()
		print()


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		p = r = self.head
		q = p.next
		c = 0

		def insert(key):
			t = Node(key)
			t.next = self.head
			self.head = t
		while q:
			if q.data == 0:
				c += 1
				r.next = q.next
				q = None
				q = r.next
			else:
				r = q
				q = q.next
		while c:
			insert(0)
			c -= 1
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		count1 = 0
		count2 = 0
		current = self.head
		while current != None:
			if current.data == 0:
				count1 += 1
			else:
				count2 += 1
			current = current.next
		if count1 == 0:
			return
		if count2 == 0:
			return
		zh = None
		z = None
		nzh = None
		nz = None
		current = self.head
		while current != None:
			if current.data == 0:
				if zh == None:
					zh = current
					z = current
				else:
					z.next = current
					z = z.next
			elif nzh == None:
				nzh = current
				nz = current
			else:
				nz.next = current
				nz = nz.next
			current = current.next
		z.next = nzh
		self.head = zh
		if nz.next != None:
			nz.next = None

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		zero = []
		nonzero = []
		p = self.head
		while p:
			if p.data == 0:
				zero.append(p.data)
				p = p.next
			else:
				nonzero.append(p.data)
				p = p.next
		res = zero + nonzero
		temp = self.head
		i = 0
		while temp:
			temp.data = res[i]
			i = i + 1
			temp = temp.next
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		x = []
		p = []
		temp = self.head
		while temp:
			if temp.data == 0:
				x.append(temp.data)
			else:
				p.append(temp.data)
			temp = temp.next
		x.extend(p)
		y = Node(x[0])
		z = y
		for i in range(1, len(x)):
			new = Node(x[i])
			z.next = new
			z = new
		self.head = y

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		curr = self.head
		arr = []
		count = 0
		while curr != None:
			if curr.data == 0:
				count += 1
				curr = curr.next
			else:
				arr.append(curr.data)
				curr = curr.next
		curr = self.head
		for i in range(0, count):
			curr.data = 0
			curr = curr.next
		for i in range(0, len(arr)):
			curr.data = arr[i]
			curr = curr.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		vals = []
		zeros = 0
		temp = self.head
		while temp:
			if temp.data == 0:
				zeros += 1
			else:
				vals.append(temp.data)
			temp = temp.next
		temp = self.head
		i = 0
		while temp:
			if zeros > 0:
				temp.data = 0
				zeros -= 1
			else:
				temp.data = vals[i]
				i += 1
			temp = temp.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		vec = []
		tmp = self.head
		poi = self.head
		zeros = 0
		while tmp:
			if tmp.data == 0:
				zeros += 1
			else:
				vec.append(tmp.data)
			tmp = tmp.next
		for i in range(zeros):
			poi.data = 0
			poi = poi.next
		for i in range(len(vec)):
			poi.data = vec[i]
			poi = poi.next
		return poi

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		zeroes = []
		nums = []
		node = self.head
		while node:
			if node.data != 0:
				zeroes.append(node.data)
			node = node.next
		node = self.head
		while node:
			if node.data == 0:
				nums.append(node.data)
			node = node.next
		ans = nums + zeroes
		ll = LinkedList()
		while len(ans):
			ll.push(ans.pop())
		self.head = ll.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		if self.head is None:
			return
		p = self.head
		zh = None
		nh = None
		n = None
		while p:
			if p.data == 0:
				if zh is None:
					zh = p
					p = p.next
					z = zh
					z.next = None
				else:
					z.next = p
					p = p.next
					z = z.next
					z.next = None
			elif nh is None:
				nh = p
				p = p.next
				n = nh
				n.next = None
			else:
				n.next = p
				p = p.next
				n = n.next
				n.next = None
		if zh is None:
			self.head = nh
		else:
			z.next = nh
			self.head = zh

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		curr = self.head
		c = 0
		l = []
		while curr:
			if curr.data == 0:
				c += 1
			else:
				l.append(curr.data)
			curr = curr.next
		k = [0] * c + l
		curr1 = self.head
		while curr1:
			curr1.data = k.pop(0)
			curr1 = curr1.next
		return curr1

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		count = 0
		iter = self.head
		other = []
		while iter:
			if iter.data == 0:
				count += 1
			else:
				other.append(iter.data)
			iter = iter.next
		iter = self.head
		while iter:
			if count:
				iter.data = 0
				count -= 1
			else:
				iter.data = other.pop(0)
			iter = iter.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		temp = self.head
		n = 0
		st = []
		while temp:
			if temp.data == 0:
				n += 1
			else:
				st.append(temp.data)
			temp = temp.next
		temp = self.head
		k = 0
		while temp:
			if n:
				temp.data = 0
				n -= 1
			else:
				temp.data = st[k]
				k += 1
			temp = temp.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		count = 0
		currNode = self.head
		while currNode:
			if currNode.data == 0:
				count += 1
				if currNode == self.head:
					count -= 1
				else:
					prevNode.next = currNode.next
					currNode = prevNode
			prevNode = currNode
			currNode = currNode.next
		while count:
			count -= 1
			newNode = Node(0)
			newNode.next = self.head
			self.head = newNode

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		h = self.head
		(a, b) = (Node(-1), Node(-1))
		(prev1, prev2) = (a, b)
		while h != None:
			if h.data == 0:
				prev1.next = h
				prev1 = h
				h = h.next
				prev1.next = None
			else:
				prev2.next = h
				prev2 = h
				h = h.next
				prev2.next = None
		prev1.next = b.next
		self.head = a.next

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next


class Node:

	def __init__(self, data):
		self.data = data
		self.next = None

class LinkedList:

	def __init__(self):
		self.head = None

	def push(self, val):
		new_node = Node(val)
		new_node.next = self.head
		self.head = new_node

	def moveZeroes(self):
		tem = self.head
		l = []
		new = []
		c = 0
		while tem:
			if tem.data != 0:
				l.append(tem.data)
				tem = tem.next
			else:
				c = c + 1
				tem = tem.next
		for i in range(c):
			new.append(0)
		new.extend(l)
		self.head.next = None
		self.head.data = new[0]
		t = self.head
		for i in range(1, len(new)):
			b = Node(new[i])
			t.next = b
			t = t.next
		return self.head

	def display(self):
		temp = self.head
		while temp is not None:
			print(temp.data, end=' ')
			temp = temp.next