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;
vector<int> pr;
int a[105], dp[105][(1 << 18) + 5], go[105][(1 << 18) + 5], save[65];
bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
int Set(int N, int pos) { return N = N | (1 << pos); }
int status[(65 / 32) + 2];
void sieve(int N) {
  int i, j, sqrtN;
  sqrtN = int(sqrt(N));
  for (i = 3; i <= sqrtN; i += 2) {
    if (Check(status[i >> 5], i & 31) == 0) {
      for (j = i * i; j <= N; j += (i << 1)) {
        status[j >> 5] = Set(status[j >> 5], j & 31);
      }
    }
  }
  pr.push_back(2);
  for (i = 3; i <= N; i += 2)
    if (Check(status[i >> 5], i & 31) == 0) pr.push_back(i);
}
int call(int i, int m, int n) {
  if (i == n) return 0;
  if (dp[i][m] == -1) {
    int tmp;
    dp[i][m] = 100000;
    for (int j = 1; j < 60; j = j + 1) {
      if ((save[j] & m) != 0) continue;
      tmp = abs(a[i] - j) + call(i + 1, m | save[j], n);
      if (tmp < dp[i][m]) {
        dp[i][m] = tmp;
        go[i][m] = j;
      }
    }
  }
  return dp[i][m];
}
void print(int i, int m, int n) {
  if (i == n) return;
  printf("%d ", go[i][m]);
  print(i + 1, m | save[go[i][m]], n);
}
int main() {
  memset(dp, -1, sizeof(dp));
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i = i + 1) scanf("%d", &a[i]);
  sieve(60);
  for (int i = 2; i < 60; i = i + 1) {
    for (int j = 0; j < pr.size(); j = j + 1) {
      if (pr[j] > 60 || pr[j] > i) break;
      if (i % pr[j] == 0) {
        save[i] |= (1 << j);
      }
    }
  }
  call(0, 0, n);
  print(0, 0, n);
  return 0;
}