def solution(record):
name = {}
room = [] #0은 들어가기, 1은 나가기
for r in record:
info = r.split(' ')
if info[0] == "Enter":
name[info[1]] = info[2]
room.append((info[1], 0))
elif info[0] == "Leave":
room.append((info[1], 1))
else:
name[info[1]] = info[2]
answer = []
for i, j in room:
if j == 0:
answer.append(name[i] + "님이 들어왔습니다.")
else:
answer.append(name[i] + "님이 나갔습니다.")
return answer