#!/usr/bin/env python
# coding: utf-8

# In[10]:


N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

for i in range(N):
    tmp = [x for x in A]
    del tmp[i]
    print(max(tmp))


# In[ ]:




