n | f_max = int(input()) | n | x_max = int(input()) |
| s_max = int(input()) | | y_max = int(input()) |
| | | |
n | if f_max == s_max == 0: | n | if x_max == y_max == 0: |
| print('Error') | | print('Error') |
n | elif s_max == 0: | n | elif y_max == 0: |
| print('NO') | | print('NO') |
| else: | | else: |
n | if f_max < s_max: | n | if x_max < y_max: |
| f_max, s_max = s_max, f_max | | x_max, y_max = y_max, x_max |
| elem = int(input()) | | elem = int(input()) |
| while elem != 0: | | while elem != 0: |
n | if elem > f_max: | n | if elem > x_max: |
| s_max, f_max = f_max, elem | | y_max, x_max = x_max, elem |
| elif (elem > s_max) and (elem != f_max): | | elif (elem > y_max) and (elem != x_max): |
| s_max = elem | | y_max = elem |
| elem = int(input()) | | elem = int(input()) |
n | if f_max == s_max: | n | if x_max == y_max: |
| print('NO') | | print('NO') |
| else: | | else: |
t | print(s_max) | t | print(y_max) |
| | | |