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;
struct num {
  int x, y;
};
num a[109];
int p[20] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53},
    d[109][150000], c[109][150000], ans, n, i, f[60];
bool srt(num a, num b) {
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}
bool srt2(num a, num b) { return a.y < b.y; }
int fun(int x) {
  if (f[x] != -1) return f[x];
  f[x] = 0;
  for (int i = 0; i < 16 && p[i] <= x; i++)
    if (x % p[i] == 0) f[x] |= (1 << i);
  return f[x];
}
int dp(int i, int m) {
  if (i == n) return 0;
  if (d[i][m] != -1) return d[i][m];
  d[i][m] = a[i].x - 1 + dp(i + 1, m);
  c[i][m] = 1;
  if (a[i].x == 1) return d[i][m];
  for (int j = 2; j <= 53; j++)
    if (!(m & fun(j)) && abs(j - a[i].x) + dp(i + 1, m | fun(j)) < d[i][m]) {
      d[i][m] = abs(j - a[i].x) + dp(i + 1, m | fun(j));
      c[i][m] = j;
    }
  return d[i][m];
}
void dp2(int i, int m) {
  if (i == n) return;
  if (c[i][m] == 1) {
    cout << "1 ";
    dp2(i + 1, m);
    return;
  }
  cout << c[i][m] << " ";
  dp2(i + 1, m | fun(c[i][m]));
}
int main() {
  memset(d, -1, sizeof d);
  memset(f, -1, sizeof f);
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i].x;
    a[i].y = i;
  }
  if (n > 16) {
    sort(a, a + n, srt);
    for (i = 0; i < n - 16; i++) {
      ans += a[i].x - 1;
      a[i].x = 1;
    }
    sort(a, a + n, srt2);
  }
  ans += dp(0, 0);
  dp2(0, 0);
  return 0;
}