Skip to content

Instantly share code, notes, and snippets.

@modos
Created October 14, 2023 11:03
Show Gist options
  • Save modos/07b30e2fb0bd5f3ebc1e220fe08ec5e5 to your computer and use it in GitHub Desktop.
Save modos/07b30e2fb0bd5f3ebc1e220fe08ec5e5 to your computer and use it in GitHub Desktop.
کاسه و نخود
n = int(input())
ans = 1
for i in range(n):
a, b = map(int, input().split())
if a == ans:
ans = b
elif b == ans:
ans = a
print(ans)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment