(N, M) = raw_input().split(" ")
N = int(N)
M = int(M)
mat = [[True]*N for x in range(N)]
for i in range(M):
rule = raw_input().split(" ")
s = int(rule[1])-1
e = int(rule[2])-1
n = int(rule[3])-1
for j in range(s):
mat[j][n] = False
for j in range(e+1,N):
mat[j][n] = False
if rule[0] == '1':
for j in range(s,e+1):
for k in range(n+1,N):
mat[j][k] = False;
if rule[0] == '2':
for j in range(s,e+1):
for k in range(n):
mat[j][k] = False;
Count = 0
res = [0]*N
used = [False]*N
while Count < N:
done = False
for i in range(N):
if res[i] != 0:
continue
ok = True
count = 0
count = 0
found = -1
for j in range(N):
if mat[i][j] == True:
count += 1
found = j
if count == 0:
ok = False
print -1
break
if count == 1:
res[i] = found+1
for k in range(N):
mat[k][found] = False
used[found] = True
Count += 1
done = True
if not ok:
break
for i in range(N):
if used[i]:
continue
ok = True
count = 0
count = 0
found = -1
for j in range(N):
if mat[j][i] == True:
count += 1
if mat[j][i] == True:
count += 1
found = j
if count == 0:
ok = False
print -1
break
if count == 1:
res[found] = i+1
for k in range(N):
mat[k][i] = False
used[i] = True
Count += 1
done = True
if not ok:
break
if not done:
for i in range(N):
if res[i] != 0:
continue
for j in range(N):
if mat[i][j]:
res[i] = j+1
for k in range(N):
mat[k][j] = False
used[i] = True
Count += 1
done = True
break
if done:
break
if ok:
print " ".join([str(x) for x in res])