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 maxn = 100 + 10;
const int maxm = 4e5 + 10;
const long long mod = 1e9 + 7;
const int inf = 0x3ffffff;
const double eps = 1e-5;
int n, cnt, ed, mn = inf, ans;
int f[maxn][1 << 16], fa[maxn][1 << 16];
int v[maxn], q[maxn], a[60];
int p[16] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};
inline int cal(int x) {
  int sum = 0;
  for (int i = 0; i < 16; i++)
    if (x % p[i] == 0) sum += (1 << i);
  return sum;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (int i = 1; i < 59; i++) a[i] = cal(i);
  memset(f, -1, sizeof(f));
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> v[i];
  ed = (1 << 16) - 1;
  f[0][0] = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= ed; j++)
      if (f[i][j] != -1) {
        for (int k = 1; k < 59; k++) {
          int to = j + a[k], t = f[i][j] + abs(k - v[i + 1]);
          if (((j | a[k]) == to) && (t < f[i + 1][to] || f[i + 1][to] == -1)) {
            f[i + 1][to] = t;
            fa[i + 1][to] = k;
          }
        }
      }
  for (int i = 0; i <= ed; i++) {
    if (f[n][i] < mn && f[n][i] != -1) {
      ans = i;
      mn = f[n][i];
    }
  }
  for (int i = n; i; i--) {
    q[i] = fa[i][ans];
    ans -= a[q[i]];
  }
  for (int i = 1; i <= n; i++) cout << q[i] << " ";
  return ~~(0 - 0);
}