#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * b / gcd(a, b); }
int main() {
  int n;
  cin >> n;
  int a[n];
  int max = 0;
  int ans = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 0; j < n; j++) {
    for (int i = 0; i < n; i++) {
      if (i != j) {
        if (ans < a[i]) ans = a[i];
      }
    }
    cout << ans << endl;
    ans = 0;
  }
  return 0;
}
