aboutsummaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorIgor <50257429+igorechek06@users.noreply.github.com>2021-10-07 21:44:13 +0900
committerIgor <50257429+igorechek06@users.noreply.github.com>2021-10-07 21:44:13 +0900
commitfa47878227cca261b7f33c369bde7b71feb4fb63 (patch)
tree3835f914ca1bbbcb7e1f32d8937cac2fb681ceb5 /test.py
parent82e4b1ee7c69ca73378922d5fdf3a30b38dd23fa (diff)
downloadkarpov_ai_bot-fa47878227cca261b7f33c369bde7b71feb4fb63.tar.gz
karpov_ai_bot-fa47878227cca261b7f33c369bde7b71feb4fb63.zip
УРА НОВЫЙ РЕЛИЗ СПУСТЯ 1000 лет
Diffstat (limited to 'test.py')
-rw-r--r--test.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/test.py b/test.py
new file mode 100644
index 0000000..d7ec5be
--- /dev/null
+++ b/test.py
@@ -0,0 +1,28 @@
1n = int(input())
2lt = []
3
4for i in range(n - 1):
5 lt += [list(map(str, input().split()))]
6
7lts = [lt[0]]
8l = lt[0][0]
9r = lt[0][1]
10lt.pop(0)
11
12for i in range(n - 2):
13 for j in range(len(lt)):
14 if lt[j][0] == r:
15 lts += [lt[j]]
16 lt.pop(j)
17 r = lts[-1][-1]
18 break
19 elif lt[j][1] == l:
20 lts = [lt[j]] + lts
21 lt.pop(j)
22 l = lts[0][0]
23 break
24
25for i in range(n - 2, -1, -1):
26 print(lts[i][1])
27
28print(lts[0][0])