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>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
template <typename T>
void DBG(const char* name, T&& H) {
  cerr << name << " = " << H << ')' << '\n';
}
template <typename T, typename... Args>
void DBG(const char* names, T&& H, Args&&... args) {
  const char* NEXT = strchr(names + 1, ',');
  cerr.write(names, NEXT - names) << " = " << H << " |";
  DBG(NEXT + 1, args...);
}
const int mod = 1e9 + 7;
const int INF = 1e8;
const int maxN = 101;
const int maxM = (1LL << 17);
int n;
vector<int> a(maxN);
vector<int> prime = {2,  3,  5,  7,  11, 13, 17, 19, 23,
                     29, 31, 37, 41, 43, 47, 53, 59};
vector<int> divisor(60);
vector<vector<int>> dp(maxN, vector<int>(maxM, -1));
vector<vector<int>> best(maxN, vector<int>(maxM, -1));
vector<int> ans;
int rec(int idx, int mask) {
  if (idx == n) return 0;
  if (dp[idx][mask] != -1) return dp[idx][mask];
  int ans = INF;
  int choice = 1;
  ans = rec(idx + 1, mask) + abs(a[idx] - 1);
  for (int i = 2; i < 60; i++) {
    if (mask & divisor[i]) continue;
    int newMask = (mask | divisor[i]);
    int res = rec(idx + 1, newMask) + abs(a[idx] - i);
    if (res < ans) {
      ans = res;
      choice = i;
    }
  }
  dp[idx][mask] = ans;
  best[idx][mask] = choice;
  return dp[idx][mask];
}
void buildAns(int idx, int mask) {
  if (idx == n) return;
  ans.push_back(best[idx][mask]);
  mask |= divisor[best[idx][mask]];
  buildAns(idx + 1, mask);
}
void Solve() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i < 60; i++) {
    int x = i;
    int mask = 0;
    for (int j = 0; j < prime.size(); j++) {
      if (x % prime[j]) continue;
      mask |= (1LL << j);
      while ((x % prime[j]) == 0) {
        x /= prime[j];
      }
    }
    divisor[i] = mask;
  }
  rec(0, 0);
  buildAns(0, 0);
  for (auto i : ans) {
    cout << i << " ";
  }
  cout << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tt = 1;
  while (tt--) {
    Solve();
  }
  return 0;
}