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;
static const double EPS = 1e-10;
template <typename T, typename S>
vector<T>& operator<<(vector<T>& a, S b) {
  a.push_back(b);
  return a;
}
template <typename T>
void operator>>(vector<T>& a, int b) {
  while (b--)
    if (!a.empty()) a.pop_back();
}
bool isprime(int n) {
  if (n < 2) return false;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
long long b_pow(long long x, long long n) {
  return n ? b_pow(x * x, n / 2) * (n % 2 ? x : 1) : 1ll;
}
string itos(int n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
int dp[110][1 << 18];
int a[110];
int n;
vector<int> o;
int flag[62];
int dfs(int x, int bit) {
  if (x >= n) return 0;
  if (dp[x][bit] != -1) return dp[x][bit];
  int res = 1e9;
  for (int i = 1; i <= 60; i++) {
    if (i == 1) {
      res = min(res, dfs(x + 1, bit) + abs(a[x] - i));
    } else if (!(flag[i] & bit)) {
      res = min(res, dfs(x + 1, bit | flag[i]) + abs(a[x] - i));
    }
  }
  return dp[x][bit] = res;
}
int rec(int x, int bit) {
  if (x >= n) return 0;
  int res = 1e9;
  for (int i = 1; i <= 60; i++) {
    if (i == 1) {
      if (dfs(x, bit) == dfs(x + 1, bit) + abs(a[x] - i)) {
        cout << i << " ";
        rec(x + 1, bit);
        return 0;
      }
    } else if (!(flag[i] & bit)) {
      if (dfs(x, bit) == dfs(x + 1, bit | flag[i]) + abs(a[x] - i)) {
        cout << i << " ";
        rec(x + 1, bit | flag[i]);
        return 0;
      }
    }
  }
  return dp[x][bit] = res;
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n;
  for (int i = 1; i <= 60; i++) {
    if (isprime(i)) {
      o.push_back(i);
    }
  }
  for (int i = 1; i <= 60; i++) {
    for (int j = 0; j < o.size(); j++)
      if (i % o[j] == 0) {
        flag[i] |= (1 << j);
      }
  }
  for (int i = 0; i < n; i++) cin >> a[i];
  rec(0, 0);
  cout << endl;
}