import java.awt.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

public class Main {
    static int mod = (int) 1e9 + 7;
    public static void main(String[] args) {
        FastReader sc = new FastReader();
        int n=sc.nextInt();
        int[] arr=new int[n];
        int t=0;
        for(int i=0;i<n;i++)arr[i]=sc.nextInt();
        int index=0;
        for(int i=31;i>=0;i--){
            int occur=0;
            for(int j=0;j<n;j++){
                if((arr[j]&(1<<i))>=1){
                    index=j;
                    occur++;
                }
            }
            if(occur==1)break;
        }
        int temp=arr[index];
        arr[index]=arr[0];
        arr[0]=temp;
        for(int i=0;i<n;i++) System.out.print(arr[i]+" ");
    }
}
class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}