#include <bits/stdc++.h>
using namespace std;
void exeption_handling() {
  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) {
    int v_max = 0;
    for (int j = 0; j < n; ++j) {
      if (i == j)
        continue;
      else if (v_max < a[j])
        v_max = a[j];
    }
    cout << v_max << "\n";
  }
}
void city_savers() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  vector<int> b(n);
  for (int i = 0; i < n + 1; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
}
void build_stairs() {
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) cin >> h[i];
  for (int i = n - 1; i > 0; --i) {
    if (h[i - 1] - h[i] > 1) {
      cout << "No"
           << "\n";
      return;
    } else if (h[i - 1] - h[i] == 1) {
      --h[i - 1];
    }
  }
  cout << "Yes"
       << "\n";
}
void green_bin() {
  int n;
  cin >> n;
  map<string, int> S;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    S[s]++;
  }
  long long int ana_num = 0;
  for (auto value : S)
    for (int cnt = value.second - 1; cnt > 0; --cnt) ana_num += cnt;
  cout << ana_num << "\n";
}
void alchemist() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) cin >> v[i];
  sort(v.begin(), v.end());
  double v_sum = v[0];
  for (int i = 1; i < n; ++i) v_sum = (v_sum + v[i]) / 2;
  cout << v_sum << "\n";
}
void lower_atc() {
  int n;
  cin >> n;
  vector<int> h(n);
  for (int i = 0; i < n; ++i) cin >> h[i];
  int tmp = 0, v_max = 0;
  for (int i = 0; i < n; ++i) {
    if ((i != n - 1) && h[i] >= h[i + 1])
      ++tmp;
    else {
      v_max = max(v_max, tmp);
      tmp = 0;
    }
  }
  cout << v_max << "\n";
}
void maximal_value() {
  int n;
  cin >> n;
  vector<int> b(n - 1);
  for (int i = 0; i < n - 1; ++i) cin >> b[i];
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    if (i == 0)
      a[i] = b[i];
    else if (i == n - 1)
      a[i] = b[i - 1];
    else
      a[i] = min(b[i - 1], b[i]);
  }
  cout << accumulate(a.begin(), a.end(), 0) << "\n";
}
int main() { exeption_handling(); }
