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;
int n, arr[101], memo[101][(1 << 17)], msk[101];
vector<vector<int> > fac(201);
const int N = 200;
int sv[N], pos[N];
void factrize(int n, vector<int> &v) {
  if (n == 1) return;
  if (sv[n] == 0) sv[n] = n;
  v.push_back(sv[n]);
  if (sv[n] == n) return;
  factrize(n / sv[n], v);
}
int solve(int idx, int mask) {
  if (idx == n) return 0;
  if (memo[idx][mask] != -1) return memo[idx][mask];
  int ret = 1e5;
  for (auto i = 1; i <= (long long)(60); i++) {
    if ((mask & msk[i]) == 0)
      ret = min(ret, abs(arr[idx] - i) + solve(idx + 1, mask | msk[i]));
  }
  return memo[idx][mask] = ret;
}
void get(int idx, int mask) {
  if (idx == n) {
    exit(0);
  }
  for (auto i = 1; i <= (long long)(60); i++) {
    if ((mask & msk[i]) == 0 &&
        solve(idx + 1, mask | msk[i]) + abs(arr[idx] - i) == memo[idx][mask]) {
      cout << i << " ";
      get(idx + 1, mask | msk[i]);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(memo, -1, sizeof memo);
  vector<bool> vis(65, 1);
  int idx = 0;
  for (int i = 2; i * i < N; i++)
    if (sv[i] == 0) {
      pos[i] = idx++;
      for (int j = i; j < N; j += i)
        if (sv[j] == 0) sv[j] = i;
    }
  for (auto i = 2; i <= (long long)(60); i++)
    if (!sv[i]) pos[i] = idx++;
  for (int i = 1; i <= 60; i++) {
    factrize(i, fac[i]);
    int mask = 0;
    for (auto j : fac[i]) {
      mask |= (1 << pos[j]);
    }
    msk[i] = mask;
  }
  cin >> n;
  for (auto i = 0; i < (long long)(n); i++) cin >> arr[i];
  solve(0, 0);
  get(0, 0);
  return 0;
}