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 n;
vector<int> a;
vector<pair<int, int> > a_copy;
vector<int> best;
vector<int> best_ok;
int best_diff;
bool gcd[65][65];
vector<int> bb;
int Gcd(int x, int y) {
  if (y == 0) return x;
  if (y > x) return Gcd(y, x);
  return Gcd(y, x % y);
}
int Diff(const vector<int>& b) {
  int ans = 0;
  for (int i = 0; i < (n); i++) {
    ans += abs(a[i] - b[i]);
  }
  return ans;
}
void Print(const vector<int>& x) {
  for (int i = 0; i < ((int)x.size() - 1); i++) printf("%d ", x[i]);
  printf("%d\n", x[x.size() - 1]);
}
void Check(const vector<int>& b) {
  int diff = Diff(b);
  if (diff < best_diff) {
    best_diff = diff;
    best = b;
  }
}
void GenerateNext(int pos) {
  if (pos < n - 16) return;
  int start = bb[pos];
  for (int c = bb[pos] + 1; c < 2 * a[pos] && (pos == n - 1 || c < bb[pos + 1]);
       c++) {
    bool ok = true;
    for (int i = (pos + 1); i <= (n - 1); i++) {
      if (gcd[c][bb[i]]) {
        ok = false;
        break;
      }
    }
    if (ok) {
      bb[pos] = c;
      Check(bb);
      GenerateNext(pos - 1);
    }
  }
  bb[pos] = start;
}
int main() {
  for (int i = 0; i < (65); i++)
    for (int j = 0; j < (65); j++) gcd[i][j] = (Gcd(i, j) > 1);
  scanf("%d", &n);
  for (int i = 0; i < (n); i++) {
    int x;
    scanf("%d", &x);
    a.push_back(x);
    a_copy.push_back(make_pair(x, i));
  }
  sort(a.begin(), a.end());
  sort(a_copy.begin(), a_copy.end());
  for (int i = 0; i < (n); i++) bb.push_back(1);
  best = bb;
  best_diff = n * 30;
  Check(bb);
  GenerateNext(n - 1);
  for (int i = 0; i < (n); i++) best_ok.push_back(0);
  for (int i = 0; i < (n); i++) {
    best_ok[a_copy[i].second] = best[i];
  }
  Print(best_ok);
  return 0;
}