#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int a[N];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  int flag = -1;
  for (int i = 31; i >= 0; i--) {
    int cnt = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] & (1 << i)) cnt++, flag = j;
    }
    if (cnt == 1) break;
    flag = -1;
  }
  if (flag == -1) flag = 0;
  for (int i = flag;; i = (i + 1) % n) {
    printf("%d ", a[i]);
    if ((i + 1) % n == flag) break;
  }
  return 0;
}
