#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
typedef vector<double> VI;
typedef vector<VI> VVI;
typedef long long ll;
int main() {
  ll c = 0, d = 0, k = 0, n, m, h, w, p, q, min, ans = 0;
  string s, s1, s2;
  cin >> n;
  VI a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    c = a[i];
    a[i] = 0;
    cout << *max_element((a).begin(), (a).end()) << endl;
    a[i] = c;
  }
  return 0;
}
