#include<bits/stdc++.h>
using namespace std;

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

