#include<iostream>
using namespace std;
const int maxn=200000+5;
int n,a[maxn],clone[maxn],ans[maxn];
int main(){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>a[i];
        clone[i]=a[i];
    }
    /*for(int i=0;i<n;i++){
        cout<<clone[i]<<" ";
    }*/
    int temp;
    for(int i=0;i<n;i++){
        temp=clone[i];
        clone[i]=0;
        sort(clone,clone+n);
        cout<<clone[n-1]<<endl;
        for(int j=0;j<n;j++){
            clone[j]=a[j];
        }
        clone[i]=temp;
    }
    return 0;
}