#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int main() {
  long long n, i;
  cin >> n;
  long long a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    long long b = a[i];
    a[i] = NULL;
    long long max = a[0];
    for (long long j = 1; j < n; j++) {
      if (a[j] > max) max = a[j];
    }
    cout << max << endl;
    a[i] = b;
  }
}
