Given an array arr[] of size N, enqueue the elements of the array into a queue and then dequeue them.
Example 1:
Input:
N = 5 
arr[] = 1 2 3 4 5 
Output: 
1 2 3 4 5
Example 2:
Input:
N = 7
arr[] = 1 6 43 1 2 0 5
Output:
1 6 43 1 2 0 5
Your Task:
You don't need to read any input. Your task is to complete the functions push() and _pop(). The function push() takes the array and its size as the input parameters and returns the queue formed, and the function _pop(), takes the queue as the input parameter and prints the elements of the queue.
 
Expected time complexity: O(n)
Expected space complexity: O(n)
 
Constraints:
1 <= A_{i} <= 10^{7}

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

Starter code:
#User function Template for python3

def push(arr,n): 
    
    #return a queue with all elements of arr inserted in it
    
    
    
def _pop(q):
    
    #dequeue elements and print them

Solutions:
def push(arr, n):
	q = []
	for i in arr:
		q.append(i)
	return q

def _pop(queue):
	for i in range(len(q)):
		print(q.pop(0), end=' ')


def push(arr, n):
	return arr

def _pop(q):
	for i in q:
		print(i, end=' ')


def push(arr, n):
	arr += [n]
	return arr

def _pop(q):
	for i in range(len(q) - 1):
		print(q[i], end=' ')


def push(arr, n):
	q = deque()
	for i in range(n):
		q.append(arr[i])
	return q

def _pop(q):
	for j in range(len(q)):
		print(q.popleft(), end=' ')


def push(arr, n):
	return arr.copy()

def _pop(q):
	if not q:
		return
	for i in q:
		print(i, end=' ')


import queue as p

def push(arr, n):
	q = p.Queue(maxsize=n)
	for i in arr:
		q.put(i)
	return q

def _pop(q):
	n = q.qsize()
	for i in range(n):
		print(q.get(), end=' ')


def push(arr, n):
	que = []
	for i in arr:
		que.append(i)
	return que

def _pop(q):
	while q:
		print(q.pop(0), end=' ')


def push(arr, n):
	li = []
	for i in arr:
		li.append(i)
	return li

def _pop(q):
	while q:
		a = q.pop(0)
		print(a, end=' ')


def push(arr, n):
	return list(arr)

def _pop(q):
	while q:
		x = q.pop(0)
		print(x, end=' ')


def push(arr, n):
	for i in range(n):
		q.append(arr[i])
	return q

def _pop(q):
	for i in range(n):
		print(q.popleft(), end=' ')


from collections import deque

def push(arr, n):
	q = deque()
	for a in arr:
		q.append(a)
	return q

def _pop(q):
	while len(q) != 0:
		print(q.popleft(), end=' ')


from collections import deque

def push(arr, n):
	queue = []
	for i in arr:
		queue.append(i)
	return queue

def _pop(q):
	for i in range(len(q)):
		print(q.pop(0), end=' ')


def push(arr, n):
	for k in arr:
		q.appendleft(k)
	return q

def _pop(q):
	for a in range(n):
		print(q.pop(), end=' ')


def push(arr, n):
	return arr

def _pop(q):
	for i in range(n):
		print(q.pop(0), end=' ')


def push(arr, n):
	q = deque()
	for i in arr:
		q.append(i)
	return q

def _pop(q):
	while len(q):
		e = q.popleft()
		print(e, end=' ')


def push(arr, n):
	l = []
	for i in arr:
		l.append(i)
	return l

def _pop(q):
	while arr:
		e = arr.pop(0)
		print(e, end=' ')


def push(arr, n):
	return arr

def _pop(q):
	print(*q, end='')


from collections import deque

def push(arr, n):
	return deque(arr)

def _pop(q):
	while bool(q) is not False:
		print(q.popleft(), end=' ')


def push(arr, n):
	d = deque()
	for i in arr:
		d.append(i)
	return d

def _pop(d):
	while len(d) != 0:
		print(d.popleft(), end=' ')


def push(arr, n):
	q = []
	for ele in arr:
		q.append(ele)
	return q

def _pop(q):
	for ele in q:
		print(ele, end=' ')


def push(arr, n):
	l = []
	for i in range(0, n):
		l.append(arr[i])
	return l

def _pop(q):
	a = push(arr, n)
	while bool(a) == True:
		print(a.pop(0), end=' ')


def push(arr, n):
	l = []
	for i in range(n):
		l.append(arr[i])
	return l

def _pop(q):
	a = push(arr, n)
	for i in range(len(a)):
		print(arr[i], end=' ')


def push(arr, n):
	return arr

def _pop(q):
	for item in q:
		print(item, end=' ')


def push(arr, n):
	return arr[::-1]

def _pop(q):
	while q:
		print(q.pop(), end=' ')


def push(arr, n):
	q = deque()
	for x in arr:
		q.append(x)
	return q

def _pop(q):
	while len(q):
		print(q.popleft(), end=' ')


def push(arr, n):
	a = []
	for x in arr:
		a.append(x)

def _pop(q):
	for x in arr:
		print(x, end=' ')


def push(arr, n):
	q = []
	for i in arr:
		q.append(i)

def _pop(q):
	for i in arr:
		print(i, end=' ')


def push(arr, n):
	stack = []
	stack[:] = arr[:]
	return stack

def _pop(q):
	a = push(arr, n)
	for i in range(len(a)):
		print(a[i], end=' ')


def push(arr, n):
	return arr

def _pop(q):
	while len(q) != 0:
		print(q.pop(0), end=' ')


from queue import Queue

def push(arr, n):
	q = Queue()
	for i in arr:
		q.put(i)
	return q

def _pop(q):
	size = q.qsize()
	while size > 0:
		size -= 1
		print(q.get(), end=' ')


def push(arr, n):
	d = deque()
	for i in range(n):
		d.append(arr[i])
	return d

def _pop(q):
	for i in q:
		print(i, end=' ')


def push(arr, n):
	return arr

def _pop(q):
	if q == []:
		return -1
	else:
		while q != []:
			print(q.pop(0), end=' ')


def push(arr, n):
	for i in arr:
		q.append(i)
	return q

def _pop(q):
	if len(q) == 0:
		return
	for i in range(len(q)):
		print(q.popleft(), end=' ')


import queue

def push(arr, n):
	q = []
	for i in range(len(arr)):
		q.insert(0, arr[i])
	return q

def _pop(q):
	for i in range(len(q)):
		print(q.pop(-1), end=' ')


from queue import Queue

def push(arr, n):
	q = Queue()
	for i in range(n):
		q.put(arr[i])
	return q

def _pop(q):
	while not q.empty():
		print(q.get(), end=' ')


from collections import deque

def push(arr, n):
	q = deque()
	for i in arr:
		q.append(i)
	return q

def _pop(q):
	for i in q:
		print(i, end=' ')


def push(arr, n):
	q = deque()
	while arr:
		x = arr.pop()
		q.append(x)
	return q

def _pop(q):
	ans = []
	while q:
		print(q.pop(), end=' ')


from queue import LifoQueue

def push(arr, n):
	arr.reverse()
	q = LifoQueue()
	for i in arr:
		q.put(i)
	return q

def _pop(q):
	for i in range(0, len(arr)):
		print(q.get(), end=' ')


def push(arr, n):
	q = deque()
	for item in arr:
		q.append(item)
	return q

def _pop(q):
	while len(q) > 0:
		print(q.popleft(), end=' ')


q = []

def push(arr, n):
	for i in range(n):
		q.append(arr[i])
	return q

def _pop(q):
	q.reverse()
	for j in range(n):
		print(q.pop(), end=' ')


def push(arr, n):
	l = []
	for x in arr:
		l.append(x)
	return l

def _pop(q):
	for x in q:
		print(x, end=' ')
	del q
import atexit
import io
import sys
from collections import deque
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
if __name__ == '__main__':
	test_cases = int(input())
	for cases in range(test_cases):
		n = int(input())
		arr = list(map(int, input().strip().split()))
		q = deque()
		q = push(arr, n)
		_pop(q)
		print()


def push(arr, n):
	q = []
	for i in range(n):
		q.append(arr[i])
	return q

def _pop(q):
	i = 0
	while i < n and len(q) != 0:
		if len(q) == 0:
			return -1
		else:
			f = q[i]
			print(f, end=' ')
		i += 1
import atexit
import io
import sys
from collections import deque
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
if __name__ == '__main__':
	test_cases = int(input())
	for cases in range(test_cases):
		n = int(input())
		arr = list(map(int, input().strip().split()))
		q = deque()
		q = push(arr, n)
		_pop(q)
		print()