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