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 n, arr[100];
long long mapped[56];
long long getbit[56];
long long cache[100][65536];
long long dp(long long pos, long long mask) {
  if (pos == n) return 0;
  if (cache[pos][mask] != -1) return cache[pos][mask];
  long long ans = 1000000000;
  for (long long i = 1; i <= 53; i++) {
    if (!(getbit[i] & mask))
      ans = min(ans, abs(arr[pos] - i) + dp(pos + 1, getbit[i] | mask));
  }
  return cache[pos][mask] = ans;
}
void path(long long pos, long long mask) {
  if (pos == n) exit(0);
  long long ans = 1000000000;
  for (long long i = 1; i <= 53; i++) {
    if (!(getbit[i] & mask))
      ans = min(ans, abs(arr[pos] - i) + dp(pos + 1, getbit[i] | mask));
  }
  for (long long i = 1; i <= 53; i++) {
    if (!(getbit[i] & mask))
      if (ans == abs(arr[pos] - i) + dp(pos + 1, getbit[i] | mask)) {
        cout << i << " ";
        path(pos + 1, getbit[i] | mask);
      }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> arr[i];
  mapped[2] = 1;
  mapped[3] = 2;
  mapped[5] = 3;
  mapped[7] = 4;
  mapped[11] = 5;
  mapped[13] = 6;
  mapped[17] = 7;
  mapped[19] = 8;
  mapped[23] = 9;
  mapped[29] = 10;
  mapped[31] = 11;
  mapped[37] = 12;
  mapped[41] = 13;
  mapped[43] = 14;
  mapped[47] = 15;
  mapped[53] = 16;
  for (long long i = 1; i <= 53; i++) {
    long long bit = 0;
    long long temp = i;
    for (long long j = 2; j * j <= temp; j++) {
      while (temp % j == 0) {
        temp /= j;
        bit |= (1 << (mapped[j] - 1));
      }
    }
    if (temp >= 2) bit |= (1 << (mapped[temp] - 1));
    getbit[i] = bit;
  }
  memset(cache, -1, sizeof(cache));
  dp(0, 0);
  path(0, 0);
}