#include <bits/stdc++.h>
using namespace std;
template <typename T>
void MACRO_VAR_Scan(T &t) {
  std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First &first, Rest &...rest) {
  std::cin >> first;
  MACRO_VAR_Scan(rest...);
}
template <typename T>
void MACRO_VEC_ROW_Init(int n, T &t) {
  t.resize(n);
}
template <typename First, typename... Rest>
void MACRO_VEC_ROW_Init(int n, First &first, Rest &...rest) {
  first.resize(n);
  MACRO_VEC_ROW_Init(n, rest...);
}
template <typename T>
void MACRO_VEC_ROW_Scan(int p, T &t) {
  std::cin >> t[p];
}
template <typename First, typename... Rest>
void MACRO_VEC_ROW_Scan(int p, First &first, Rest &...rest) {
  std::cin >> first[p];
  MACRO_VEC_ROW_Scan(p, rest...);
}
template <typename T>
void MACRO_OUT(const T t) {
  std::cout << t;
}
template <class A>
void pr(A a) {
  cout << a;
  cout << '\n';
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << ' ' << b << endl;
}
template <typename T>
T square(T x) {
  return x * x;
}
long long int gcd(long long int a, long long int b) {
  while (b) {
    long long int c = b;
    b = a % b;
    a = c;
  }
  return a;
}
long long int lcm(long long int a, long long int b) {
  if (!a || !b) return 0;
  return a * b / gcd(a, b);
}
bool yes = 0;
bool boo = 0;
int mx = -100000;
int mn = 1001001001;
int sum = 0;
int ans = 0.0;
int co = 0;
int abc[26];
bool OK = false;
int main() {
  int n;
  MACRO_VAR_Scan(n);
  ;
  vector<int> v(n);
  for (long long int i = 0; i < (n); i++) cin >> v[i];
  for (long long int i = 0; i < (n); i++) {
    for (long long int j = 0; j < (n); j++) {
      if (i != j) mx = max(mx, v[j]);
    }
    pr(mx);
    mx = -1;
  }
}
