#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, i;
  scanf("%d", &n);
  vector<int> v, x;
  for (i = 0; i < n; i++) {
    scanf("%d", &a);
    v.push_back(a);
  }
  for (i = 0; i < n; i++) {
    v = x;
    x.erase(x.begin() + i);
    sort(x.begin(), x.end());
    printf("%d\n", x[0]);
    x.clear();
  }
  return 0;
}
