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>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:666000000")
using namespace std;
const int INF = (1 << 30) - 1;
const long double EPS = 1e-9;
void ML(const bool v) {
  if (v) return;
  int *ass;
  for (;;) {
    ass = new int[2500000];
    for (int i = 0; i < 2500000; i++) ass[i] = rand();
  }
}
void TL(const bool v) {
  if (v) return;
  for (;;) cout << rand() % (rand() % 1000) << endl;
}
void PE(const bool v) {
  if (v) return;
  for (int i = 0; i < 10000; i++) printf("%c", rand() % 256);
  exit(0);
}
const int MX = 60;
int a[105];
int n;
int ps[18];
int pn = 0;
int divs_msk[MX];
void pre() {
  bool was[MX];
  memset(was, false, sizeof(was));
  for (int i = 2; i < MX; i++)
    if (!was[i]) {
      ps[pn++] = i;
      for (int j = i; j < MX; j += i) was[j] = true;
    }
  for (int i = 1; i < MX; i++) {
    for (int j = 0; j < pn; j++)
      if (0 == i % ps[j]) divs_msk[i] = (divs_msk[i] | (1 << (j)));
  }
}
void LoAd() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
}
int sv[105][(1 << 18) + 5];
int nxt[105][(1 << 18) + 5];
int go(const int pos, const int msk) {
  if (pos == n) return 0;
  int nmsk = 0;
  int &res = sv[pos][msk];
  if (-1 != res) return res;
  res = INF;
  for (int i = 1; i < MX; i++)
    if (0 == (msk & divs_msk[i])) {
      int tmp = abs(i - a[pos]) + go(pos + 1, msk | divs_msk[i]);
      if (tmp < res) {
        res = tmp;
        nxt[pos][msk] = i;
      }
    }
  return res;
}
void print(const int pos, const int msk) {
  int i = nxt[pos][msk];
  if (-1 != i) {
    printf("%d ", i);
    print(pos + 1, msk | divs_msk[i]);
  }
}
void SoLvE() {
  memset(sv, -1, sizeof(sv));
  memset(nxt, -1, sizeof(nxt));
  int res = go(0, 0);
  ;
  print(0, 0);
}
int main() {
  srand((int)time(NULL));
  pre();
  LoAd();
  SoLvE();
  return 0;
}