def solution(k,room_number):
    room_dic={};ret=[]
    for i in room_number:
        n=i;visit=[n]
        while n in room_dic:n=room_dic[n];visit+=[n]
        ret+=[n]
        for j in visit:room_dic[j]=n+1
    return ret