Buggy python submission (verdict: Runtime Error):
import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 2))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
mat = np.c_[mat, np.array(range(m))]
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(m)
res = []
for i in mat[:, 0]:
	i = int(i)
	cnt[i] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i])))

for i in np.argsort(mat[:, 2]):
	print(res[int(i)])


Fixed submission:
import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 3))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
	mat[i, 2] = i
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(n+1)
res = []
for i in mat[:, 0]:
	i = int(i)
	cnt[i-1] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i-1])))

for idx in np.argsort(mat[:, 2]):
	print(res[int(idx)])

Buggy python submission (verdict: Runtime Error):
import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 2))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
mat = np.c_[mat, np.array(range(m))]
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(m)
res = []
for i, in mat[:, 0]:
	i = int(i)
	cnt[i] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i])))

for i in np.argsort(mat[:, 2]):
	print(res[int(i)])


Fixed submission:
import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 3))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
	mat[i, 2] = i
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(n+1)
res = []
for i in mat[:, 0]:
	i = int(i)
	cnt[i-1] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i-1])))

for idx in np.argsort(mat[:, 2]):
	print(res[int(idx)])

Buggy python submission (verdict: Runtime Error):
import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 2))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
mat = np.c_[mat, np.array(range(m))]
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(m)
res = []
for i, j in mat[:, :2]:
	i = int(i)
	cnt[i] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i])))

for i in np.argsort(mat[:, 2]):
	print(res[int(i)])


Fixed submission:
import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 3))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
	mat[i, 2] = i
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(n+1)
res = []
for i in mat[:, 0]:
	i = int(i)
	cnt[i-1] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i-1])))

for idx in np.argsort(mat[:, 2]):
	print(res[int(idx)])

Buggy python submission (verdict: Runtime Error):
import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 2))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
mat = np.c_[mat, np.array(range(m))]
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(m)
res = []
print(cnt[2])
for i, j in mat[:, :2]:
	i = int(i)
	cnt[i] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i])))
#print(res)
#print(list(mat_[:, 2]))
for i in np.argsort(mat[:, 2]):
	print(res[int(i)])
#res_ = res[np.argsort(mat_[:, 2])]
#for r in res_:
#	print(r)	


Fixed submission:
import numpy as np

n, m = list(map(int, input().split()))
mat = np.zeros((m, 3))
for i in range(m):
	mat[i, 0], mat[i, 1] = list(map(int, input().split()))
	mat[i, 2] = i
mat = mat[mat[:, 1].argsort()]
cnt = np.zeros(n+1)
res = []
for i in mat[:, 0]:
	i = int(i)
	cnt[i-1] += 1
	res.append('{0:06d}{1:06d}'.format(i, int(cnt[i-1])))

for idx in np.argsort(mat[:, 2]):
	print(res[int(idx)])