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 long long int inf = 1e15;
const long long int mod = 1000000007;
const int infInt = 1e9;
const double PI = acos(-1.00);
const double eps = 1e-6;
int a[110], n;
long long int divs[110];
int crib[110];
int dp[(1 << 16)][101];
bool vis[(1 << 16)][101];
vector<int> primes;
int f(int mask, int ind) {
  if (ind == 0) return 0;
  int ans = infInt;
  if (vis[mask][ind]) return dp[mask][ind];
  vis[mask][ind] = true;
  for (int i = 1; i < min(2 * a[ind], 54); i++) {
    if ((mask & divs[i]) == 0) {
      ans = min(ans, f(mask | divs[i], ind - 1) + abs(i - a[ind]));
    }
  }
  return dp[mask][ind] = ans;
}
void rec(int mask, int ind) {
  if (ind == 0) return;
  for (int i = 1; i < min(2 * a[ind], 54); i++) {
    if ((mask & divs[i]) == 0 and
        dp[mask][ind] == f(mask | divs[i], ind - 1) + abs(i - a[ind])) {
      rec(mask | divs[i], ind - 1);
      cout << i << " ";
      break;
    }
  }
}
void criba() {
  for (int i = 4; i <= 53; i += 2) crib[i] = 2;
  for (int i = 3; i * i <= 53; i += 2) {
    for (int j = i * i; j <= 53; j += 2 * i) {
      crib[j] = i;
    }
  }
  for (int i = 2; i <= 53; i++) {
    if (!crib[i]) primes.push_back(i);
  }
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(NULL);
  criba();
  int tam = primes.size();
  for (int i = 2; i <= 53; i++) {
    for (int j = 0; j < tam; j++) {
      if (i % primes[j] == 0) divs[i] |= (1 << j);
    }
  }
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  f(0, n);
  rec(0, n);
}