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;
vector<int> primes, ad[70];
bool status[105];
int n, ara[105], dp[105][(1 << 18) + 5], mp[105], dir[105][(1 << 18) + 5];
bool Check(int n, int pos) { return (bool)(n & (1 << pos)); }
int Set(int n, int pos) { return n = (n | (1 << pos)); }
void gen() {
  int i, j, si = sqrt(102);
  for (i = 3; i <= si; i += 2) {
    if (!status[i]) {
      for (j = i * i; j <= 100; j += i) {
        status[j] = true;
      }
    }
  }
  primes.push_back(2);
  for (i = 3; i <= 100; i += 2) {
    if (!status[i]) {
      primes.push_back(i);
    }
  }
  memset(mp, -1, sizeof mp);
  for (i = 0; i < primes.size(); i++) {
    mp[primes[i]] = i;
  }
}
int func(int indx, int mask) {
  if (indx == n) {
    return 0;
  }
  if (dp[indx][mask] != -1) {
    return dp[indx][mask];
  }
  int ans = ara[indx] - 1 + func(indx + 1, mask);
  dir[indx][mask] = 1;
  for (int val = 2; val <= 60; val++) {
    bool flag = true;
    for (int v : ad[val]) {
      bool p = Check(mask, mp[v]);
      if (p) {
        flag = false;
        break;
      }
    }
    if (flag) {
      int temp = mask;
      for (int v : ad[val]) {
        temp = Set(temp, mp[v]);
      }
      int ret = abs(ara[indx] - val) + func(indx + 1, temp);
      if (ret < ans) {
        ans = ret;
        dir[indx][mask] = val;
      }
    }
  }
  return dp[indx][mask] = ans;
}
void go(int indx, int mask) {
  if (indx == n) return;
  cout << dir[indx][mask] << ' ';
  int temp = mask;
  if (dir[indx][mask] == 1) {
    go(indx + 1, mask);
  } else {
    for (int v : ad[dir[indx][mask]]) {
      temp = Set(temp, mp[v]);
    }
    go(indx + 1, temp);
  }
}
int main() {
  gen();
  int i, j;
  for (i = 2; i <= 60; i++) {
    int num = i;
    for (int v : primes) {
      if (num % v == 0) {
        ad[i].push_back(v);
      }
    }
  }
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> ara[i];
  }
  memset(dp, -1, sizeof dp);
  int ans = func(0, 0);
  go(0, 0);
  cout << endl;
  return 0;
}