Geek is given a task to select at most 10 employees for a company project. Each employee is represented by a single digit ID number which is unique for all the selected employees for the project. Geek has a technical problem in his system which printed ID number multiple times. You are given array a[ ] of N elements having all printed IDs. Help him to get rid of the repeated IDs.
Example 1:
Input:
N = 5
a[ ] = {8, 8, 6, 2, 1}
Output:
8 6 2 1
Example 2:
Input:
N = 6
a[ ] = {7, 6, 7, 4, 2, 7}
Output:
7 6 4 2
Your Task:  
You don't need to read input or print anything. Your task is to complete the function uniqueId() which takes the array a[] and its size N as input parameters and returns the list containing non repeated IDs of employees in the same sequence they appear.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)
Constraints:
1 ≤ N ≤ 1000
0 ≤ a[i] ≤ 9

Source: geeksforgeeks | Difficulty: EASY
Tags: Data structures

Starter code: #User function Template for python3

def uniqueId( a, n):
    
    
    

Solutions:
def uniqueId(a, n):
	d = {}
	for i in a:
		d[i] = d.get(i, 1)
	l = []
	for i in a:
		if d[i] == 1:
			l.append(i)
			d[i] -= 1
	return l


def uniqueId(a, n):
	ans = []
	for num in a:
		if num not in ans:
			ans.append(num)
	return ans


def uniqueId(a, n):
	res = []
	[res.append(x) for x in a if x not in res]
	return res


def uniqueId(a, n):
	mp = {}
	ans = []
	for i in range(n):
		if a[i] in mp:
			pass
		else:
			mp[a[i]] = 1
			ans.append(a[i])
	return ans


def uniqueId(a, n):
	freq = {}
	result = []
	for i in a:
		if i in result:
			pass
		else:
			result.append(i)
	return result


def uniqueId(a, n):
	li = []
	for i in a:
		if i not in li:
			li.append(i)
	return li


def uniqueId(a, n):
	t = []
	for i in a:
		if i not in t:
			t.append(i)
	return t


def uniqueId(a, n):
	b = []
	for i in range(n):
		if a[i] not in b:
			b.append(a[i])
	return b


def uniqueId(a, n):
	u = []
	for i in a:
		if i in u:
			continue
		u.append(i)
	return u


def uniqueId(a, n):
	arr = []
	for i in range(n):
		if a[i] not in arr:
			arr.append(a[i])
		else:
			continue
	return arr


def uniqueId(a, n):
	lst = []
	for i in a:
		if i not in lst:
			lst.append(i)
	return lst


def uniqueId(a, n):
	c = []
	for i in a:
		if i not in c:
			c.append(i)
	return c


def uniqueId(a, n):
	lis = []
	freq = set()
	for i in a:
		if i not in freq:
			freq.add(i)
			lis.append(i)
	return lis


def uniqueId(a, n):
	s = {}
	for i in a:
		if i in s:
			s[i] += 1
		else:
			s[i] = 1
	b = []
	for i in range(n):
		if s[a[i]] == 1:
			b.append(a[i])
		elif s[a[i]] > 1:
			b.append(a[i])
			s[a[i]] = 0
	return b


def uniqueId(a, n):
	p = []
	for elem in a:
		p.append(elem) if elem not in p else None
	return p


def uniqueId(a, n):
	l = []
	for i in a:
		if i in l:
			continue
		l.append(i)
	return l


def uniqueId(a, n):
	t = []
	for i in a:
		if i in t:
			continue
		else:
			t.append(i)
	return t


def uniqueId(arr, n):
	rs = []
	for i in arr:
		if i not in rs:
			rs.append(i)
	return rs


def uniqueId(a, n):
	ans = []
	for i in a:
		if i not in ans:
			ans.append(i)
	return ans


def uniqueId(a, n):
	l = []
	for i in a:
		if i not in l:
			l.append(i)
	return l


def uniqueId(a, n):
	output = []
	for id in a:
		if id not in output:
			output.append(id)
	return output


def uniqueId(a, n):
	b = []
	for i in range(0, n):
		if a[i] in b:
			continue
		else:
			b.append(a[i])
	return b


def uniqueId(a, n):
	unique_list = []
	for x in a:
		if x not in unique_list:
			unique_list.append(x)
	return unique_list


def uniqueId(a, n):
	k = list()
	for i in a:
		if i not in k:
			k.append(i)
	return k


def uniqueId(a, n):
	r = [-1] * n
	d = {}
	for j in range(0, n):
		if a[j] not in d:
			d[a[j]] = j
	for j in d:
		r[d[j]] = j
	r = [j for j in r if j != -1]
	return r


def uniqueId(a, n):
	res = []
	for i in a:
		if i not in res:
			res.append(i)
	return res


from collections import OrderedDict

def uniqueId(a, n):
	OD = OrderedDict()
	for item in a:
		if item not in OD:
			OD[item] = 1
	return list(OD.keys())


from collections import OrderedDict

def uniqueId(a, n):
	return list(OrderedDict.fromkeys(a))


def uniqueId(a, n):
	ans = []
	for v in a:
		if a.count(v) != 1:
			if ans.__contains__(v) == False:
				ans.append(v)
		else:
			ans.append(v)
	return ans


def uniqueId(a, n):
	b = []
	for a1 in a:
		if a1 not in b:
			b.append(a1)
	return b


def uniqueId(a, n):
	d = []
	for x in a:
		if x not in d:
			d.append(x)
	return d


def uniqueId(a, n):
	res = []
	for val in a:
		if val not in res:
			res.append(val)
	return res


def uniqueId(a, n):
	dict = {}
	b = []
	for element in a:
		if dict.get(element) == None:
			dict[element] = 1
			b.append(element)
		else:
			dict[element] += 1
	return b


def uniqueId(a, n):
	x = []
	for i in a:
		if i not in x:
			x.append(i)
	return x


def uniqueId(a, n):
	lis = []
	for i in a:
		if i not in lis:
			lis.append(i)
	return lis


def uniqueId(a, n):
	list1 = []
	for element in a:
		if element not in list1:
			list1.append(element)
	return list1


def uniqueId(a, n):
	ans = []
	s = set()
	for i in a:
		if i not in s:
			s.add(i)
			ans.append(i)
	return ans


def uniqueId(a, n):
	arr = a[0]
	for i in a:
		if i not in arr:
			arr += i
	return arr


def uniqueId(a, n):
	res = []
	d = {}
	for i in a:
		if i not in d:
			d[i] = 0
		d[i] += 1
	for i in a:
		if i in d:
			res.append(i)
			del d[i]
	return res


def uniqueId(a, n):
	arr = []
	for i in a:
		if i not in arr:
			arr.append(i)
	return arr


def uniqueId(a, n):
	id = []
	for i in a:
		if i not in id:
			id.append(i)
	return id


def uniqueId(a, n):
	d = []
	for ele in a:
		if not ele in d:
			d.append(ele)
	return d


def uniqueId(a, n):
	list1 = []
	list2 = []
	for i in range(n):
		if a[i] not in list1:
			list1.append(a[i])
			if a[i] in list1:
				list2.append(a[i])
	return list2


def uniqueId(a, n):
	unique = []
	for i in a:
		if i not in unique:
			unique.append(i)
	return unique


def uniqueId(a, n):
	a = list(map(int, a))
	res = []
	for i in range(n):
		if a[i] not in res:
			res.append(a[i])
	return res


def uniqueId(a, n):
	u = []
	for x in a:
		if x not in u:
			u.append(x)
	return u


from collections import OrderedDict

def uniqueId(a, n):
	k = OrderedDict()
	for i in a:
		if i in k:
			k[i] += 1
		else:
			k[i] = 1
	ls = []
	for x in k.keys():
		ls.append(x)
	return ls


def uniqueId(a, n):
	list2 = sorted(set(a), key=a.index)
	return list2


def uniqueId(a, n):
	l = []
	for i in a:
		if i not in l:
			l.append(i)
	return l

def main():
	T = int(input())
	while T > 0:
		n = int(input())
		a = [x for x in input().strip().split()]
		print(*uniqueId(a, n))
		T -= 1
if __name__ == '__main__':
	main()