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;
void RD(int &x) { scanf("%d", &x); }
void RD(long long &x) { scanf("%I64d", &x); }
void RD(double &x) { scanf("%lf", &x); }
void RD(int &x, int &y) { scanf("%d%d", &x, &y); }
void RD(long long &x, long long &y) { scanf("%I64d%I64d", &x, &y); }
void RD(double &x, double &y) { scanf("%lf%lf", &x, &y); }
void RD(char *s) { scanf("%s", s); }
void RD(char &s) { scanf("%c", &s); }
void RD(string &s) { cin >> s; }
void PR(int x) { printf("%d\n", x); }
void PR(int x, int y) { printf("%d %d\n", x, y); }
void PR(long long x) { printf("%I64d\n", x); }
void PR(char x) { printf("%c\n", x); }
void PR(char *x) { printf("%s\n", x); }
void PR(string x) { cout << x << endl; }
const long long inf = 1e9;
const long long mod = 1LL;
vector<int> prime;
int num[60];
void sieve() {
  int i, j, k;
  for ((i) = 1; (i) <= (int)(58); (i)++) {
    for ((j) = 2; (j) <= (int)(i - 1); (j)++) {
      if (i % j == 0) break;
    }
    if (j == i) prime.push_back(i);
  }
  k = (int)prime.size();
  for ((i) = 1; (i) <= (int)(58); (i)++) {
    for ((j) = 0; (j) < (int)(k); (j)++) {
      if (i % prime[j] == 0) num[i] |= (1 << j);
    }
  }
  return;
}
int a[110], b[110];
int dp[110][(1 << 16) + 10], mark[110][(1 << 16) + 10];
int solve(int n, int mask) {
  if (n == 0) return 0;
  int &ret = dp[n][mask];
  if (~ret) return ret;
  ret = (int)inf;
  int i, tmp;
  for ((i) = 1; (i) <= (int)(58); (i)++) {
    if ((num[i] & mask) == num[i]) {
      tmp = abs(i - a[n]) + solve(n - 1, mask & ~num[i]);
      if (tmp < ret) {
        ret = tmp;
        mark[n][mask] = i;
      }
    }
  }
  return ret;
}
void path(int n, int mask) {
  if (n == 0) return;
  b[n] = mark[n][mask];
  return path(n - 1, mask & ~num[b[n]]);
}
int main() {
  sieve();
  int i, n, lim;
  lim = (1 << 16) - 1;
  while (scanf("%d", &n) == 1) {
    for ((i) = 1; (i) <= (int)(n); (i)++) RD(a[i]);
    memset(dp, -1, sizeof(dp));
    solve(n, lim);
    path(n, lim);
    for ((i) = 1; (i) <= (int)(n); (i)++) printf("%d ", b[i]);
    puts("");
  }
  return 0;
}