t,n = int(input()),int(input())


base = []
for i in range(n):
	tmp = []
	par,chl = map(int,input().split(" "))
	for j in range(len(base)):
		if(par in base[j]):

		else:
			tmp.append(int(par))
			tmp.append(int(chl))

	

