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;
inline int read_int() {
  register char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  int ret = 0;
  while (c >= '0' && c <= '9') {
    ret = 10 * ret + c - 48;
    c = getchar();
  }
  return ret;
}
inline void fastwrite(int a) {
  char snum[20];
  int i = 0;
  do {
    snum[i++] = a % 10 + 48;
    a = a / 10;
  } while (a != 0);
  i = i - 1;
  while (i >= 0) putchar(snum[i--]);
  putchar('\n');
}
const long long int mod = 1000000007;
int n;
int dp[(1 << 16) + 1][101], ans1[(1 << 16) + 1][101], ans2[(1 << 16) + 1][101];
int ans[101];
int arr[101];
vector<int> primes;
int factors[60];
int solve(int mask, int cur) {
  if (dp[mask][cur] != -1) return dp[mask][cur];
  if (cur == n) return 0;
  dp[mask][cur] = 10000001;
  int res;
  for (int j = 1; j < 58; ++j) {
    if ((factors[j] & mask)) continue;
    res = abs(arr[cur] - j) + solve(mask | factors[j], cur + 1);
    if (res < dp[mask][cur]) {
      dp[mask][cur] = res;
      ans1[mask][cur] = j;
      ans2[mask][cur] = (mask | factors[j]);
    }
  }
  return dp[mask][cur];
}
int main() {
  memset(dp, -1, sizeof dp);
  for (int i = 2; i < 60; ++i) {
    bool flag = 0;
    for (int j = 2; j < i; ++j)
      if (i % j == 0) {
        flag = 1;
        break;
      }
    if (flag == 0) primes.push_back(i);
  }
  for (int i = 2; i < 60; i++) {
    for (int j = 0; j < primes.size() && primes[j] <= i; ++j) {
      if (i % primes[j] == 0) factors[i] += (1 << j);
    }
  }
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  int anss = solve(0, 0), box = 0;
  for (int i = 0; i < n; i++) {
    printf("%d ", ans1[box][i]);
    box = ans2[box][i];
  }
  return 0;
}