Problem: Princess Twilight went to Celestia and Luna's old castle to research the chest from the Elements of Harmony.

<image>

A sequence of positive integers bi is harmony if and only if for every two elements of the sequence their greatest common divisor equals 1. According to an ancient book, the key of the chest is a harmony sequence bi which minimizes the following expression:

<image>

You are given sequence ai, help Princess Twilight to find the key.

Input

The first line contains an integer n (1 ≤ n ≤ 100) — the number of elements of the sequences a and b. The next line contains n integers a1, a2, ..., an (1 ≤ ai ≤ 30).

Output

Output the key — sequence bi that minimizes the sum described above. If there are multiple optimal sequences, you can output any of them.

Examples

Input

5
1 1 1 1 1


Output

1 1 1 1 1 

Input

5
1 6 4 2 8


Output

1 5 3 1 8 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int ONE = 1 << 10;
const int TWO = 1 << 11;
const int FOUR = 1 << 12;
const int EIGHT = 1 << 13;
const int SIXTEEN = 1 << 14;
const int THIRTY = 1 << 15;
const int SIXTY = 1 << 16;
const int ONE_HUNDRED = 1 << 17;
const int TWO_HUNDRED = 1 << 18;
const int FIVE_HUNDRED = 1 << 19;
const int MILLION = 1 << 20;
void reads(string &s) {
  char c;
  s.clear();
  while (true) {
    c = getchar();
    if (c != ' ' && c != '\n') {
      s += c;
      break;
    }
  }
  while (true) {
    c = getchar();
    if (c != ' ' && c != '\n')
      s += c;
    else
      break;
  }
}
void prints(string s) {
  int i, sz = s.size();
  for (i = 0; i < sz; i++) printf("%c", s[i]);
}
string takes(string s, int from, int to) {
  int i;
  string ans;
  ans.clear();
  for (i = from; i <= to; i++) ans += s[i];
  return ans;
}
bool is_prime(int p) {
  if (p == 2) return true;
  int i;
  for (i = 2; i < p; i++) {
    if (p % i == 0) return false;
  }
  return true;
}
int a[128];
int n;
int masks[60];
int primes[60], sz = 0;
int ind[60];
bool used[128][(1 << 17) + 5];
int state[128][(1 << 17) + 5];
int best[128][(1 << 17) + 5];
void input() {
  scanf("%d", &n);
  int i;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 2; i <= 59; i++) {
    if (is_prime(i)) {
      ind[i] = sz;
      primes[sz] = i;
      sz++;
    }
  }
}
int find_mask(int p) {
  int mask = 0;
  int curr_prime = 0;
  while (curr_prime < sz) {
    while (p % primes[curr_prime] == 0) {
      p /= primes[curr_prime];
      mask |= (1 << curr_prime);
    }
    curr_prime++;
  }
  return mask;
}
void initializeData() {
  int i;
  for (i = 2; i <= 59; i++) masks[i] = find_mask(i);
}
int recurse(int pos, int mask) {
  if (pos > n) return 0;
  if (used[pos][mask]) return state[pos][mask];
  int ans = 9999999, curr;
  for (int i = 1; i <= (a[pos] << 1) - 1; i++) {
    if ((mask & masks[i]) == 0) {
      curr = abs(i - a[pos]) + recurse(pos + 1, mask | masks[i]);
      if (curr < ans) {
        ans = curr;
        best[pos][mask] = i;
      }
    }
  }
  used[pos][mask] = true;
  state[pos][mask] = ans;
  return ans;
}
void solve() {
  initializeData();
  recurse(1, 0);
  int pos = 1, mask = 0;
  while (pos <= n) {
    if (pos > 1) printf(" ");
    printf("%d", best[pos][mask]);
    mask |= masks[best[pos][mask]];
    pos++;
  }
  printf("\n");
}
int main() {
  input();
  solve();
  return 0;
}