Buggy python submission (verdict: Runtime Error):
from operator import itemgetter
import  numpy as np
import sys

input = sys.stdin.readline
n,m = map(int,input().split())

in_p = []
in_y = []
in_num = [0] * n

p = np.zeros((n,m))

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1,i]= b
    in_num[a-1]+=1

p_sort=np.sort(p,axis=1)
in_num = np.array(in_num)
in_num = m - in_num
for i in range(m):
    year=str(in_p[i]).zfill(6)
    a =  np.where(p_sort == in_y[i])
    b = int(a[1] - in_num[int(a[0])]+1 )
    print("{0}{1}\n".format(year,str(b).zfill(6)))

Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))

Buggy python submission (verdict: Runtime Error):
from operator import itemgetter
import  numpy as np
import sys

input = sys.stdin.readline
n,m = map(int,input().split())

in_p = []
in_y = []
in_num = [0] * n

p = np.zeros((n,m))

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1,i]= b
    in_num[a-1]+=1

p_sort=np.sort(p,axis=1)
in_num = np.array(in_num)
in_num = m - in_num
for i in range(m):
    year=str(in_p[i]).zfill(6)
    a =  np.where(p_sort == in_y[i])
    b = int(a[1] - in_num[int(a[0])]+1 )
    print("{0}{1}".format(year,str(b).zfill(6)))






Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))

Buggy python submission (verdict: Runtime Error):
from operator import itemgetter
import  numpy as np
import sys

input = sys.stdin.readline
n,m = map(int,input().split())

in_p = []
in_y = []
in_num = [0] * n

p = np.zeros((n,m))
print(p)

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1,i]= b
    in_num[a-1]+=1

p_sort=np.sort(p,axis=1)
in_num = np.array(in_num)
print(p_sort)
in_num = m - in_num
for i in range(m):
    year=str(in_p[i]).zfill(6)
    a =  np.where(p_sort == in_y[i])
    b = int(a[1] - in_num[int(a[0])]+1 )
    print("{0}{1}".format(year,str(b).zfill(6)))






Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))

Buggy python submission (verdict: Time Limit Exceeded):
from operator import itemgetter
import sys

input = sys.stdin.readline
n,m = map(int,input().split())

in_p = []
in_y = []
p = []

for _ in range(n):
    p.append([0])

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1].append(b)  

for i in range(n):
    p[i].sort()

for i in range(m):
    year=str(in_p[i]).zfill(6)
    a = p[in_p[i]-1].index(in_y[i]) 
    num=str(a).zfill(6)
    print("{0}{1}".format(year,num))



Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))

Buggy python submission (verdict: Runtime Error):
from operator import itemgetter
import sys

input = sys.stdin.readline
n,m = map(int,input().split())

in_p = []
in_y = []
p = []

for _ in range(n):
    p.append([])

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1].append(b)  

for i in range(n):
    p[i].sorted()

for i in range(m):
    year=str(in_p[i]).zfill(6)
    a = p[in_p[i]-1].index(in_y[i]) 
    num=str(a).zfill(6)
    print("{0}{1}".format(year,num))



Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n,m = map(int,input().split())

in_p = []
in_y = []
p = []

for _ in range(n):
    p.append([])

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1].append(b)  

for i in range(n):
    p[i].sort()

for i in range(m):
    year=str(in_p[i]).zfill(6)
    a = p[in_p[i]-1].index(in_y[i]) + 1
    num=str(a).zfill(6)
    print("{0}{1}".format(year,num))



Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

in_p = []
in_y = []
p = []

for _ in range(n):
    p.append([])

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1].append(b)  

for i in range(n):
    p[i].sort()

for i in range(m):
    year=str(in_p[i]).zfill(6)
    a = p[in_p[i]-1].index(in_y[i]) + 1
    num=str(a).zfill(6)
    print("{0}{1}".format(year,num))



Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

in_p = []
in_y = []
p = []

for i in range(n):
    p.append([])

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1].append(b)  

for i in range(n):
    p[i].sort()

for i in range(m):
    year=str(in_p[i]).zfill(6)
    a = p[in_p[i]-1].index(in_y[i]) + 1
    num=str(a).zfill(6)
    print("{0}{1}".format(year,num))



Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

in_p = []
in_y = []
p = []

for i in range(n):
    p.append([])

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1].append(b)  

p = sorted(p, key = lambda x:x[:])

for i in range(m):
    year=str(in_p[i]).zfill(6)
    a = p[in_p[i]-1].index(in_y[i]) + 1
    num=str(a).zfill(6)
    print("{0}{1}".format(year,num))



Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

in_p = []
in_y = []
p = []

for i in range(n):
    p.append([])

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1].append(b)  

    p = sorted(p, key = lambda x:x[:])

for i in range(m):
    year=str(in_p[i]).zfill(6)
    a = p[in_p[i]-1].index(in_y[i]) + 1
    num=str(a).zfill(6)
    print("{0}{1}".format(year,num))



Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

in_p = []
in_y = []

p = []
for i in range(n):
    p.append([])

for i in range(m):
    a,b = map(int,input().split())
    in_p.append(a)
    in_y.append(b)
    p[a-1].append(b)  

for i in range(n):
    p[i].sort()


for i in range(m):
    year=str(in_p[i]).zfill(6)
    a = p[in_p[i]-1].index(in_y[i]) + 1
    num=str(a).zfill(6)
    print("{0}{1}".format(year,num))



Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

def func(l,x):
    return [i for i,_x in enumerate(l) if _x == x]

p = []
y = []
number = []


for i in range(m):
    a,b = map(int,input().split())
    c=1
    for j in func(p,a):
        if y[j] < b:
            c+=1
        else:
            number[j] += 1
    p.append(a)
    y.append(b)
    number.append(c)

for i in range(m):
    year=str(p[i]).zfill(6)
    num=str(number[i]).zfill(6)
    print("{0}{1}".format(year,num))



Fixed submission:
import copy

n,m = map(int,input().split())

cnt = [0]*(10**5+4)

yy = []
yp = []
for _ in range(m):
    a,b = map(int,input().split())
    a,b = b,a
    yy.append([a,0])
    yp.append([a,b])

inlist = copy.deepcopy(yp)
yp.sort()
yy = dict(yy)

for i in range(m):
    cnt[yp[i][1]]+=1
    yy[yp[i][0]] = cnt[yp[i][1]]

for key,value in inlist:
    print("{:06}{:06}".format(value,yy[key]))