#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

int main() {
   int a;
   cin>>a;
   vector<int> vec(a);
   rep(i,a){
      cin>>vec.at(i);
   }
   rep(i,a){
      int tes=vec.at(i);
      vec.at(i)=0;
      int max = *std::max_element(vec.begin(), vec.end());
      cout<<max<<endl;
      vec.at(i)=tes;
   }
}

