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 double PI = acos(-1.0);
const double EPS = 1e-9;
const int INF = 1123123123;
const int MOD = 1e9 + 7;
inline void OPEN(const string &s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
int n;
int a[105], ans[105];
int vis[101][(1 << 17)], memo[101][(1 << 17)];
int mask[60];
vector<int> p;
pair<int, int> origin[105];
int prime(int a) {
  for (int i = 2; i * i <= a; i++) {
    if (a % i == 0) return 0;
  }
  return 1;
}
int dp(int pos, int state) {
  if (pos == n) return 0;
  if (vis[pos][state]) return memo[pos][state];
  int ret = INF, ans = 1;
  int tmp;
  for (int i = 1; i < 60; i++) {
    if ((state & mask[i]) == 0) {
      tmp = abs(a[pos] - i) + dp(pos + 1, state + mask[i]);
      if (ret > tmp) {
        ret = tmp;
        ans = i;
      }
    }
  }
  vis[pos][state] = ans;
  memo[pos][state] = ret;
  return ret;
}
int main() {
  memset(vis, 0, sizeof(vis));
  for (int i = 2; i < 60; i++) {
    if (prime(i)) p.push_back(i);
  }
  for (int i = 2; i < 60; i++) {
    for (int j = 0; j < (int)(p).size(); j++) {
      if (i % p[j] == 0) mask[i] += (1 << j);
    }
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &origin[i].first);
    origin[i].second = i;
  }
  sort(origin, origin + n);
  for (int i = 0; i < n; i++) {
    a[i] = origin[i].first;
  }
  a[n] = 60;
  dp(0, 0);
  int now = 0;
  for (int i = 0; i < n; i++) {
    ans[origin[i].second] = vis[i][now];
    now = mask[vis[i][now]] + now;
  }
  for (int i = 0; i < n; i++) printf("%d ", ans[i]);
  return 0;
}