#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 1LL << 60;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n;
  cin >> n;
  vector<long long> num(n, 0);
  for (long long i = 0; i < (long long)(n); i++) cin >> num[i];
  for (long long i = 0; i < (long long)(n); i++) {
    vector<long long> copy(n, 0);
    for (long long j = 0; j < n; j++) {
      copy[j] = num[j];
    }
    copy[i] = 0;
    sort(copy.begin(), copy.end());
    cout << copy[n - 1] << endl;
  }
}
