#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N;i++){
        cin >> A[i];
    }
    
    for (int i = 0; i < N;i++){
        int tmp = A[i];
        A[i] = 0;
        int max = *max_element(B.begin(), B.end());
        cout << max << endl;
        A[i] = tmp;
    }
    return 0;
}