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 INF = (1LL << 62);
const int inf = (1LL << 30);
const int maxn = (int)1e6 + 5;
const int MOD = 1000000007;
using namespace std;
int a[150];
int p[150];
bool prime(int x) {
  for (int i = 2; i * i <= x; ++i)
    if (x % i == 0) return false;
  return true;
}
vector<int> fact(int x) {
  int d = 2;
  vector<int> res;
  while (x > 1) {
    int e = 0;
    while (x % d == 0) {
      x /= d;
      e++;
    }
    if (e) res.push_back(d);
    d++;
  }
  return res;
}
int n;
int memo[110][1 << 18];
int act[110][1 << 18];
int pmask[65];
vector<vector<int> > adj;
int dp(int p, int mask) {
  if (p >= n) return 0;
  if (memo[p][mask] != -1) return memo[p][mask];
  int res = inf;
  for (int i = 1; i <= 60; ++i) {
    if (pmask[i] & mask) continue;
    int w = abs(a[p] - i) + dp(p + 1, mask | pmask[i]);
    if (w < res) {
      res = w;
      act[p][mask] = i;
    }
  }
  return memo[p][mask] = res;
}
void doit(int p, int mask) {
  while (p < n) {
    if (p > 0) cout << ' ';
    int choice = act[p][mask];
    cout << choice;
    p++;
    mask |= pmask[choice];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  memset(p, -1, sizeof(p));
  int cur = 0;
  adj = vector<vector<int> >(65);
  for (int i = 2; i <= 60; ++i)
    if (prime(i)) p[i] = cur++;
  for (int i = 1; i <= 60; ++i) {
    adj[i] = fact(i);
  }
  for (int i = 1; i <= 60; ++i)
    for (int j = 0; j < adj[i].size(); ++j) {
      int factor = adj[i][j];
      pmask[i] |= (1 << p[factor]);
    }
  memset(memo, -1, sizeof(memo));
  dp(0, 0);
  doit(0, 0);
  return 0;
}