#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long factorial(long long n) {
  long long answer = 1;
  while (n > 1) {
    answer *= n;
    answer %= mod;
    n--;
  }
  return answer;
}
long long combination(long long n, long long r) {
  return factorial(n) / (factorial(r) * factorial(n - r));
}
long long permutation(long long n, long long r) {
  return factorial(n) / factorial(n - r);
}
template <typename T>
void remove(std::vector<T>& vector, unsigned int index) {
  vector.erase(vector.begin() + index);
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) {
    cin >> a[i];
  }
  for (int i = 0; i < (n); i++) {
    vector<int> b = a;
    remove(b, i);
    sort(b.rbegin(), b.rend());
    cout << b[0] << endl;
  }
  return 0;
}
