#include <iostream>
#include<vector>
#include<algorithm>
#include<string.h>
using namespace std;
int main(void){
    int N;
    cin>>N;
    vector<int>A(N);
    vector<int>B(N);
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    memcpy(B,A,sizeof(A));
    
    for(int j=0;j<N;j++){
        A[j]=0;
        sort(A.begin(),A.end());
        cout<<A[N-1]<<endl;
        memcpy(A,B,sizeof(A));
    }
}