Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- s = int(input())
- m1 = s
- m2 = s
- for i in range(n-1):
- s = int(input())
- if s < m1 and s > m2:
- m1 = s
- elif s < m2 and s > m1:
- m2 = s
- elif s < m2 and s < m1:
- if m1 < m2:
- m2 = s
- else:
- m1 = s
- if m1 < m2:
- print(m1, m2)
- else:
- print(m2, m1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement