#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1001001001;
const vector<int> di = {-1, 0, 1, 0};
const vector<int> dj = {0, -1, 0, 1};
void chmin(int &a, int b) {
  if (a > b) a = b;
}
ll GCD(ll a, ll b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
ll LCM(ll a, ll b) {
  ll g = GCD(a, b);
  return a / g * b;
}
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 b = a[i];
    a[i] = 0;
    int res = 0;
    for (int(i) = 0; (i) < (n); ++(i)) {
      res = max(res, a[i]);
    }
    cout << res << endl;
    a[i] = b;
  }
}
