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;
inline void __CIN__() {
  ios::sync_with_stdio(false);
  cin.tie(0);
}
char buf;
inline int xint() {
  while (buf = getchar(), buf < '0' || buf > '9')
    ;
  int x = buf - '0';
  for (; buf = getchar(), buf >= '0' && buf <= '9'; x = x * 10 + buf - '0')
    ;
  return x;
}
inline long long xll() {
  while (buf = getchar(), buf < '0' || buf > '9')
    ;
  long long x = buf - '0';
  for (; buf = getchar(), buf >= '0' && buf <= '9'; x = x * 10 + buf - '0')
    ;
  return x;
}
inline string xstring() {
  while (buf = getchar(), buf == ' ' || buf == '\n')
    ;
  string x = "";
  for (x += buf; buf = getchar(), buf != ' ' && buf != '\n'; x += buf)
    ;
  return x;
}
const int base[16] = {2,  3,  5,  7,  11, 13, 17, 19,
                      23, 29, 31, 37, 41, 43, 47, 53};
int pos[105], val[105], N, ans = (int)(1e9 + 7), y[105], tmp[105];
struct Node {
  int d, x;
  bool operator<(const Node &th) const { return x > th.x; }
} Q[105];
void dfs(int now, int k, int ret) {
  if (ret >= ans) {
    return;
  }
  if (k == N) {
    if (ret < ans) {
      for (int i = 0; i < N; ++i) tmp[i] = y[i];
      ans = ret;
    }
    return;
  }
  while (pos[now] & val[k - 1]) --now;
  while (now > 0) {
    y[Q[k].d] = now;
    val[k] = val[k - 1] | pos[now];
    dfs(now, k + 1, ret + abs(now - Q[k].x));
    --now;
    while (pos[now] & val[k - 1]) --now;
  }
  return;
}
int main() {
  for (int i = 0; i < 16; ++i) {
    for (int j = base[i]; j < 55; j += base[i]) pos[j] |= (1 << i);
  }
  N = xint();
  for (int i = 0; i < N; ++i) Q[i].x = xint(), Q[i].d = i;
  sort(Q, Q + N);
  for (int i = 54; i > 0; --i) {
    val[0] = pos[i], y[Q[0].d] = i;
    dfs(i, 1, abs(i - Q[0].x));
  }
  for (int i = 0; i < N; ++i) printf("%d%c", tmp[i], " \n"[i == N - 1]);
  return 0;
}