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 a[100], n, b[100], best = 3000, ones[101], ok[60][60];
void recurse(int *res, int *S, int len, int level) {
  int *S2 = S + len, sum = ones[n - level];
  for (int i = 0; i < level; ++i) sum += abs(a[n - level + i] - res[i]);
  if (sum < best) {
    for (int i = 0; i < n - level; ++i) b[i] = 1;
    for (int i = 0; i < level; ++i) b[n - level + i] = res[i];
    best = sum;
  }
  if (level < n)
    for (int i = 0; i < len; ++i) {
      int num = 0;
      for (int j = i + 1; j < len; ++j)
        if (ok[S[i]][S[j]]) S2[num++] = S[j];
      res[level] = S[i];
      recurse(res, S2, num, level + 1);
    }
}
int main() {
  int a2[100], res[20], S[1000], len = 0, factor[60];
  map<int, vector<int>> ans;
  for (int i = 1; i < 60; ++i) {
    for (int j = 1; j < 60; ++j) {
      ok[i][j] = (i == j) ? 0 : 1;
      for (int k = 2; k < 29; ++k)
        if (i % k == 0 && j % k == 0) {
          ok[i][j] = 0;
          break;
        }
    }
  }
  for (int i = 1; i < 60; ++i) factor[i] = 0;
  for (int i = 2; i < 60; ++i)
    for (int j = 2; i * j < 60; j++) factor[i * j] = i;
  for (int i = 2; i < 60; ++i)
    if (i <= 30 || i - 30 < abs(30 - factor[i])) S[len++] = i;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i], a2[i] = a[i];
  sort(a, a + n);
  ones[0] = 0;
  for (int i = 1; i <= n; ++i) ones[i] = ones[i - 1] + a[i - 1] - 1;
  recurse(res, S, len, 0);
  for (int i = 0; i < n; ++i) ans[a[i]].push_back(b[i]);
  for (int i = 0; i < n; ++i) {
    cout << ans[a2[i]].back() << " ";
    ans[a2[i]].pop_back();
  }
  return 0;
}