/*
ID: Div1der
LANG: C++17
TASK:
*/
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <sstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <vector <int>> vii;
typedef vector <long long> vll;
typedef vector <string> vs;
typedef vector <char> vc;
typedef set <int> si;
typedef set <string> ss;
typedef queue <int> qi;
typedef queue <long long> qll;
typedef queue <string> qs;
typedef queue <char> qc;
typedef struct board board;
typedef pair <int, int> pi;
typedef pair <long long, long long> pll;
typedef pair <int, pair<int, int>> pii;

#define eb emplace_back
#define ppb pop_back
#define clr(a) a.clear()
#define F first
#define S second
#define mkp make_pair

#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

#define left(x) x * 2
#define right(x) x * 2 + 1
#define bin(l, r) (l + r + 1) >> 1

#define ml " "
#define nl endl

#define fo(i, a, b) for (int i = a; i <= b; ++ i)
#define foo(i, a, b) for (int i = a; i >= b; -- i)

#define meme(a, b) memset(a, b, sizeof a)

template <typename T>
void printArr(const T * arr, int s, int fn) {
    for (int i = s; i <= fn; ++ i) cout << arr[i] << " ";
    cout << '\n';
}

template <typename T>
void printVec(const T * arr) {
    for (int i = 0; i < sz(arr); ++ i) cout << arr[i] << " ";
    cout << '\n';
}

void to_pray() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
}

const int N = 2e6 + 10;
const int NN = 1e3 + 10;
const int NNN = 2e3 + 9;
const int MOD = 1e9 - 7;
const int INF = 1e9 + 7;
const ll LLINF = 1e12 + 7;
const int EPS = 1e-9 - 8;
const int vN = 2e4 + 10;
const int sz = (1 << 22) - 1;
const int dx[] = {0, 0, 1, -1};
const int dy[] = {1, -1, 0, 0};
const double PI = acos(-1);

int a[N];

int main () {
    #ifdef div1der
    #endif
    //freopen(".in", "r", stdin);
    //freopen(".out", "w", stdout);
    cerr << "Ready\n";
	to_pray();
	
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++ i)
		cin >> a[i];
	for (int i = 1; i <= n; ++ i) {
		int mx = 0;
		for (int j = 1; j <= n; ++ j) {
			if (i == j)
				continue;
			mx = max(mx, a[j]);
		}
		cout << mx << '\n';

	}

    return 0;
}
