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;
long long mod = 1000000007;
long long dx[] = {-1, 1, 0, 0, -1, -1, 1, 1};
long long dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
bool test = 0;
bool isprime(long long n) {
  for (long long i = 2; i <= sqrt(n); ++i)
    if (n % i == 0) return false;
  return true;
}
const long long N = 1e2 + 5;
long long n, a[N];
long long cache[105][262145];
vector<long long> prime = {2,  3,  5,  7,  11, 13, 17, 19, 23,
                           29, 31, 37, 41, 43, 47, 53, 59};
vector<long long> mask2(60);
long long dp(long long idx, long long mask) {
  if (idx == n) {
    cache[idx][mask] = 0;
    return 0;
  }
  long long &ans = cache[idx][mask];
  if (ans != -1) return ans;
  ans = abs(a[idx] - 1) + dp(idx + 1, mask);
  for (long long i = 2; i <= 59; ++i) {
    if ((mask & mask2[i]) == 0) {
      ans = min(ans, abs(a[idx] - i) + dp(idx + 1, mask | mask2[i]));
    }
  }
  return ans;
}
void dp1(long long idx, long long mask) {
  if (idx == n) return;
  if (cache[idx][mask] == abs(a[idx] - 1) + cache[idx + 1][mask]) {
    cout << 1 << " ";
    dp1(idx + 1, mask);
    return;
  }
  for (long long i = 2; i <= 59; ++i) {
    if ((mask & mask2[i]) == 0 and
        cache[idx][mask] == cache[idx + 1][mask | mask2[i]] + abs(a[idx] - i)) {
      cout << i << " ";
      dp1(idx + 1, mask | mask2[i]);
      return;
    }
  }
}
void solve() {
  cin >> n;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  memset(cache, -1, sizeof(cache));
  for (long long i = 2; i < 60; ++i) {
    long long x = 0;
    for (long long j = 0; j < 17; ++j)
      if (i % prime[j] == 0) x |= (1ll << j);
    mask2[i] = x;
  }
  dp(0, 0);
  dp1(0, 0);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  if (test) cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}