#include <bits/stdc++.h>
#include <iostream>
#include <vector>
int main() {
	int N, i;
	std::cin >> N;
	std::vector<int> X(N);
	for (i = 0; i<N; i++) {
		std::cin >> X[i];
	}
	for (i = 0; i<N; i++) {
		j = X[i];
		X[i] = 0;
		cout << *std::max_element(X.begin(), X.end())  << endl;
		X[i] = j;
	}
}