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;
const int _N = 1e5 + 5;
const long long INF = 1e18;
const long long MOD = 1e9 + 7;
int n, arr[105], fac[66], vis[66], road[101][(1 << 18)], dp[101][(1 << 18)];
vector<int> primes;
void sieve() {
  for (int i = 2; i <= 60; i++) {
    if (vis[i]) continue;
    for (int j = i * i; j <= 60; j += i) {
      vis[j] = 1;
    }
    primes.push_back(i);
  }
}
void init() {
  for (int i = 1; i <= 60; i++) {
    int bit = 0;
    for (int j = 0; j < (int)primes.size(); j++) {
      if (i % primes[j] == 0) bit |= (1 << j);
    }
    fac[i] = bit;
  }
  memset(dp, -1, sizeof dp);
  memset(road, 0, sizeof road);
}
int solve(int idx, int bitmask) {
  if (idx == n) return 0;
  if (dp[idx][bitmask] != -1) return dp[idx][bitmask];
  int res = 1e5;
  for (int i = 1; i <= 60; i++) {
    if ((fac[i] & bitmask) == 0) {
      int var = abs(arr[idx] - i) + solve(idx + 1, bitmask | fac[i]);
      if (var < res) {
        res = var;
        road[idx][bitmask] = i;
      }
    }
  }
  return dp[idx][bitmask] = res;
}
void print(int idx, int bitmask) {
  if (idx == n) return;
  cout << road[idx][bitmask] << " ";
  print(idx + 1, fac[road[idx][bitmask]] | bitmask);
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cout << fixed;
  cout << setprecision(15);
  sieve();
  init();
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  solve(0, 0);
  print(0, 0);
  return 0;
}