본문 바로가기
Tech/Coding

백준20361🐨일우는 야바위꾼.py

by redcubes 2024. 7. 18.

_,x,k,*shupples = open(0).read().split()
k=int(k)
for i in range(0,k<<1,2):
    if shupples[i]==x:
        x = shupples[i+1]
    elif shupples[i+1]==x:
        x = shupples[i]
open(1,'w').write(x)