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;
int primes[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};
int DP[101][(1 << 16) + 5];
int ch[101][(1 << 16) + 5];
int arr[105], sum[105], sol[105];
int masks[61];
vector<int> cans[(1 << 16) + 5];
int n;
int solve(int ind, int mask) {
  if (ind == n) return 0;
  int &temp = DP[ind][mask];
  if (temp != -1) return temp;
  temp = solve(ind + 1, mask) + arr[ind] - 1;
  ch[ind][mask] = 1;
  for (int i = 0; i < cans[mask].size(); i++) {
    int x = solve(ind + 1, (masks[cans[mask][i]] | mask));
    if (x + abs(arr[ind] - cans[mask][i]) < temp)
      ch[ind][mask] = cans[mask][i], temp = x + abs(arr[ind] - cans[mask][i]);
  }
  return temp;
}
void get(int ind, int mask) {
  if (ind == n) return;
  sol[ind] = ch[ind][mask];
  get(ind + 1, masks[ch[ind][mask]] | mask);
}
int main() {
  ios_base::sync_with_stdio(0);
  memset(DP, -1, sizeof(DP));
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = n - 1; i >= 0; i--) sum[i] = sum[i - 1] + arr[i] - 1;
  for (int i = 2; i < 59; i++) {
    int temp = i, res = 0;
    for (int j = 0; j < 16 && temp != 1; j++) {
      while (temp % primes[j] == 0) temp /= primes[j], res |= (1 << j);
    }
    masks[i] = res;
  }
  for (int i = 0; i < (1 << 16); i++) {
    for (int j = 2; j < 59; j++) {
      if ((masks[j] & i) == 0) cans[i].push_back(j);
    }
  }
  solve(0, 0);
  get(0, 0);
  for (int i = 0; i < n; i++) cout << sol[i] << " ";
  return 0;
}