package BItMasking;
import java.util.Scanner;
public class uniqueE2 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int N=sc.nextInt();
int[] arr=new int[N];
for(int i=0;i<N;i++) {
arr[i]=sc.nextInt();
}
if(N%2==0) {
uniqueE2(arr,arr.length);
}else {
System.out.println("write even array");
}
}
public static void uniqueE2(int[] arr,int n) {
int sum =0;
for(int i = 0;i<n;i++)
{
sum = (sum^arr[i]);
}
sum = (sum&-sum);
int sum1 = 0;
int sum2 = 0;
for(int i = 0;i<arr.length;i++)
{
if((arr[i]&sum) > 0)
{
sum1 = (sum1^arr[i]);
}
else
{
sum2 = (sum2^arr[i]);
}
}
if(sum1<sum2) {
System.out.println(sum1+" and "+sum2);
}else {
System.out.println(sum2+" and "+sum1);
}
}
}