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 int mod = 1e9 + 7;
const int maxn = 60;
const int maxm = 17;
const long long INF = 1e18;
long long powmod(long long x, long long y) {
  long long t;
  for (t = 1; y; y >>= 1, x = x * x % mod)
    if (y & 1) t = t * x % mod;
  return t;
}
long long gcd(long long x, long long y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int prim[maxm] = {2,  3,  5,  7,  11, 13, 17, 19, 23,
                  29, 31, 37, 41, 43, 47, 53, 59},
    a[105];
int mp[maxn], dp[105][1 << maxm], nxt[105][1 << maxm];
int val(int x) { return x > 0 ? x : -x; }
void output(int n, int y, int z) {
  if (!n) return;
  output(n - 1, nxt[n - 1][y], y);
  int x = dp[n][z] - dp[n - 1][y];
  if (mp[a[n] - x] == (y ^ z))
    cout << a[n] - x << " ";
  else
    cout << a[n] + x << " ";
}
int n, mark;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int(i) = (1); (i) < (n + 1); (i)++) cin >> a[i];
  for (int(i) = (0); (i) < (maxm); (i)++) mp[prim[i]] = (1 << i);
  for (int(i) = (2); (i) < (maxn); (i)++)
    if (!mp[i]) {
      int tmp = i;
      for (int(j) = (2); (j) < (i); (j)++)
        if (tmp % j == 0) {
          while (tmp % j == 0) tmp /= j;
          mp[i] += mp[j];
        }
    }
  memset((dp), (0xf), sizeof(dp)), mark = dp[0][0], dp[0][0] = 0;
  for (int(i) = (1); (i) < (n + 1); (i)++)
    for (int(j) = (1); (j) < (maxn); (j)++)
      for (int(k) = (0); (k) < (1 << maxm); (k)++) {
        if ((k & mp[j]) == mp[j])
          if (dp[i - 1][k ^ mp[j]] != mark) {
            int tmp = dp[i - 1][k ^ mp[j]] + val(j - a[i]);
            if (dp[i][k] > tmp) dp[i][k] = tmp, nxt[i][k] = (k ^ mp[j]);
          }
      }
  int minv = mark, sta, cur;
  for (int(i) = (0); (i) < (1 << maxm); (i)++)
    if (dp[n][i] < minv) minv = dp[n][i], cur = i, sta = nxt[n][i];
  output(n, sta, cur);
  return 0;
}