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 N = 101;
int prime[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};
const int sz = sizeof(prime) / sizeof(int), V = 58;
int pos[V + 1], dp[N][1 << sz], n, A[N], minPrime[V + 1], trace[N][1 << sz];
void prepare() {
  for (int i = 2; i * i <= V; ++i)
    if (!minPrime[i])
      for (int j = i * i; j <= V; j += i)
        if (!minPrime[j]) minPrime[j] = i;
  for (int i = 2; i <= V; ++i)
    if (!minPrime[i]) minPrime[i] = i;
  for (int i = 0; i < sz; ++i) pos[prime[i]] = i;
}
int solve(int idx, int msk) {
  if (idx > n) return 0;
  int &res = dp[idx][msk];
  if (res != INT_MAX) return res;
  int s, val, d;
  for (int x = 1; x <= 58; ++x) {
    val = x;
    d = -1;
    s = 0;
    while (val > 1) {
      if (minPrime[val] != d) {
        d = minPrime[val];
        s |= (1 << pos[d]);
      }
      val /= d;
    }
    if (!(s & msk)) {
      val = abs(x - A[idx]) + solve(idx + 1, msk | s);
      if (val < res) {
        res = val;
        trace[idx][msk] = x;
      }
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> A[i];
  fill(&dp[0][0], &dp[0][0] + sizeof(dp) / sizeof(int), INT_MAX);
  prepare();
  solve(1, 0);
  int msk = 0, val, d, s;
  for (int i = 1; i <= n; ++i) {
    val = trace[i][msk];
    cout << val << ' ';
    d = -1;
    s = 0;
    while (val > 1) {
      if (minPrime[val] != d) {
        d = minPrime[val];
        s |= (1 << pos[d]);
      }
      val /= d;
    }
    msk |= s;
  }
  return 0;
}