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 dp[105][1 << 18];
int taken[105][1 << 18];
int n;
vector<int> primes;
int mascara[65];
int getMask(int number) {
  if (number == 1) return 0;
  if (mascara[number]) return mascara[number];
  int mask = 0;
  for (int i = 0; i < primes.size(); i++) {
    if (number % primes[i] == 0) mask |= (1 << i);
  }
  return mascara[number] = mask;
}
int v[200];
int solve(int pos, int bitmask) {
  if (pos == n) return 0;
  if (dp[pos][bitmask] != -1) return dp[pos][bitmask];
  int ans = v[pos] - 1 + solve(pos + 1, bitmask);
  taken[pos][bitmask] = 1;
  for (int i = 2; i <= 55; i++) {
    int mask = getMask(i);
    int gcd = bitmask & mask;
    if (gcd) continue;
    int cur = abs(v[pos] - i) + solve(pos + 1, bitmask | mask);
    if (cur < ans) {
      taken[pos][bitmask] = i;
      ans = cur;
    }
  }
  return dp[pos][bitmask] = ans;
}
int main() {
  primes.push_back(2);
  primes.push_back(3);
  primes.push_back(5);
  primes.push_back(7);
  primes.push_back(11);
  primes.push_back(13);
  primes.push_back(17);
  primes.push_back(19);
  primes.push_back(23);
  primes.push_back(29);
  primes.push_back(31);
  primes.push_back(37);
  primes.push_back(41);
  primes.push_back(43);
  primes.push_back(47);
  primes.push_back(53);
  primes.push_back(59);
  primes.push_back(61);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  memset(dp, -1, sizeof dp);
  solve(0, 0);
  int mask = 0;
  for (int i = 0; i < n; i++) {
    int took = taken[i][mask];
    cout << took << " ";
    mask |= getMask(took);
  }
  return 0;
}