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;
long long MOD = 1e9 + 7;
int OO = 1e8;
const int N = 101, M = (1 << 17) + 1;
int dp[N][M];
int pre[N];
int arr[N];
int n, m, k, T;
int a, b, c;
int Solve(int idx, int msk) {
  if (idx == n) return 0;
  int &ret = dp[idx][msk];
  if (~ret) return ret;
  ret = (arr[idx] - 1) + Solve(idx + 1, msk);
  for (int i = 2; i < 60; ++i) {
    if (msk & pre[i]) continue;
    ret = min(ret, abs(arr[idx] - i) + Solve(idx + 1, msk | pre[i]));
  }
  return ret;
}
void Bulid(int idx, int msk) {
  if (idx == n) return;
  int ret = Solve(idx, msk);
  int x = (arr[idx] - 1) + Solve(idx + 1, msk);
  if (ret == x) {
    cout << 1 << " ";
    Bulid(idx + 1, msk);
    return;
  }
  for (int i = 2; i < 60; ++i) {
    if (msk & pre[i]) continue;
    int x = abs(arr[idx] - i) + Solve(idx + 1, msk | pre[i]);
    if (x == ret) {
      cout << i << " ";
      Bulid(idx + 1, msk | pre[i]);
      return;
    }
  }
}
vector<int> prime;
vector<bool> vis;
void Bulid() {
  vis.resize(60);
  for (int i = 2; i < (int)(vis.size()); ++i) {
    if (vis[i]) continue;
    prime.push_back(i);
    for (int j = i * i; j < (int)(vis.size()); j += i) vis[j] = true;
  }
  for (int x = 2; x < 60; ++x)
    for (int i = 0; i < (int)(prime.size()); ++i)
      if (x % prime[i] == 0) pre[x] |= (1 << i);
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL), cerr.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  Bulid();
  memset(dp, -1, sizeof dp);
  cerr << Solve(0, 0) << "\n";
  Bulid(0, 0);
  return 0;
}