#include <bits/stdc++.h>
#pragma GCC optimize "-O3"
#pragma GCC target("avx")
signed gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
signed lcm(long long a, long long b) { return a * b / gcd(a, b); }
using namespace std;
const long long mod = 1e9 + 7;
long long ans = 0;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(12);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<long long> b(n);
  for (long long i = 0; i < n; ++i) {
    long long tmp = a[i];
    a[i] = 0;
    b = a;
    sort((b).begin(), (b).end(), greater<long long>());
    cout << b[0] << endl;
    a[i] = tmp;
  }
}
