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 n;
int a[101];
int bm[60];
int dp[101][131072];
int best[101][131072];
vector<int> pr;
void Primes() {
  pr.push_back(2), pr.push_back(3), pr.push_back(5), pr.push_back(7),
      pr.push_back(11);
  pr.push_back(13), pr.push_back(17), pr.push_back(19), pr.push_back(23),
      pr.push_back(29);
  pr.push_back(31), pr.push_back(37), pr.push_back(41), pr.push_back(43),
      pr.push_back(47);
  pr.push_back(53), pr.push_back(59);
  for (int i = 2; i < 60; i++)
    for (int j = 0; j < 17; j++)
      if (i % pr[j] == 0) bm[i] |= (1 << j);
}
int f(int x, int y) {
  if (x == n + 1) return 0;
  if (best[x][y]) return dp[x][y];
  dp[x][y] = 1 << 30;
  for (int i = 1; i < 60; i++)
    if ((y & bm[i]) == 0) {
      int tmp = f(x + 1, y | bm[i]) + (int)abs(a[x] - i);
      if (tmp < dp[x][y]) dp[x][y] = tmp, best[x][y] = i;
    }
  return dp[x][y];
}
int main() {
  Primes();
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  f(1, 0);
  int curr = 0;
  for (int i = 1; i <= n; i++) {
    printf("%d ", best[i][curr]);
    curr |= bm[best[i][curr]];
  }
  printf("\n");
  return 0;
}