#include <bits/stdc++.h>
using namespace std;
int gcd(long long a, long long b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }
  return b ? gcd(b, a % b) : a;
}
int lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int tmp;
  for (int i = 0; i < N; i++) {
    tmp = A[i];
    A[i] = 0;
    cout << *max_element(A, A + N) << endl;
    ;
    A[i] = tmp;
  }
}
