import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int num[] = new int[n];
		int arr[] = new int[n];
		int t;
		boolean f = false;
		for (int i = 0; i < n; i++) {
			t = in.nextInt();
			num[i] = t;
			arr[i] = t;
		}
		Arrays.sort(arr);
		for (int i = 0; i < n; i++) {
			for (int j = n - 1; j >= 0; j--) {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			}
		}
		in.close();
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int num[] = new int[n];
		int arr[] = new int[n];
		int t;
		boolean f = false;
		for (int i = 0; i < n; i++) {
			t = in.nextInt();
			num[i] = t;
			arr[i] = t;
		}
		Arrays.sort(arr);
		for (int i = 0; i < n; i++) {
			for (int j = n - 1; j >= 0; j--) {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			}
		}
		in.close();
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int num[] = new int[n];
		int arr[] = new int[n];
		int t;
		boolean f = false;
		for (int i = 0; i < n; i++) {
			t = in.nextInt();
			num[i] = t;
			arr[i] = t;
		}
		Arrays.sort(arr);
		for (int i = 0; i < n; i++) {
			for (int j = n - 1; j >= 0; j--) {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			}
		}
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int num[] = new int[n];
		int arr[] = new int[n];
		int t;
		boolean f = false;
		for (int i = 0; i < n; i++) {
			t = in.nextInt();
			num[i] = t;
			arr[i] = t;
		}
		Arrays.sort(arr);
		for (int i = 0; i < n; i++) {
			for (int j = n - 1; j >= 0; j--) {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			}
		}
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int num[] = new int[n]; num new int[n] n int arr[] = new int[n]; arr new int[n] n int t; t boolean f = false; f false for (int i = 0; i < n; i++) {
			t = in.nextInt();
			num[i] = t;
			arr[i] = t;
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			t = in.nextInt();
			num[i] = t;
			arr[i] = t;
		} {
			t = in.nextInt();
			num[i] = t;
			arr[i] = t;
		} t = in.nextInt() t in.nextInt() in.nextInt in num[i] = t num[i] num i t arr[i] = t arr[i] arr i t Arrays.sort(arr) Arrays.sort Arrays arr for (int i = 0; i < n; i++) {
			for (int j = n - 1; j >= 0; j--) {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			for (int j = n - 1; j >= 0; j--) {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			}
		} {
			for (int j = n - 1; j >= 0; j--) {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			}
		} for (int j = n - 1; j >= 0; j--) {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			} int j = n - 1; int j = n - 1; j n - 1 n 1 j >= 0 j 0 j-- j-- j {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			} {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			} if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				} !f && num[i] == arr[j] !f f num[i] == arr[j] num[i] num i arr[j] arr j {
					f = true;
					continue;
				} f = true f true continue; if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				} num[i] != arr[j] num[i] num i arr[j] arr j {
					System.out.println(arr[j]);
					f = false;
					break;
				} System.out.println(arr[j]) System.out.println System.out System System.out arr[j] arr j f = false f false break; if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				} num[i] == arr[j] && f num[i] == arr[j] num[i] num i arr[j] arr j f {
					System.out.println(arr[j]);
					f = false;
					break;
				} System.out.println(arr[j]) System.out.println System.out System System.out arr[j] arr j f = false f false break; in.close() in.close in String[] args args public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int num[] = new int[n];
		int arr[] = new int[n];
		int t;
		boolean f = false;
		for (int i = 0; i < n; i++) {
			t = in.nextInt();
			num[i] = t;
			arr[i] = t;
		}
		Arrays.sort(arr);
		for (int i = 0; i < n; i++) {
			for (int j = n - 1; j >= 0; j--) {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			}
		}
		in.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int num[] = new int[n];
		int arr[] = new int[n];
		int t;
		boolean f = false;
		for (int i = 0; i < n; i++) {
			t = in.nextInt();
			num[i] = t;
			arr[i] = t;
		}
		Arrays.sort(arr);
		for (int i = 0; i < n; i++) {
			for (int j = n - 1; j >= 0; j--) {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			}
		}
		in.close();
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int num[] = new int[n];
		int arr[] = new int[n];
		int t;
		boolean f = false;
		for (int i = 0; i < n; i++) {
			t = in.nextInt();
			num[i] = t;
			arr[i] = t;
		}
		Arrays.sort(arr);
		for (int i = 0; i < n; i++) {
			for (int j = n - 1; j >= 0; j--) {
				if (!f && num[i] == arr[j]) {
					f = true;
					continue;
				}
				if (num[i] != arr[j]) {
					System.out.println(arr[j]);
					f = false;
					break;
				} else if (num[i] == arr[j] && f) {
					System.out.println(arr[j]);
					f = false;
					break;
				}
			}
		}
		in.close();
	}
}
