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 
import static java.lang.Math.*;
import static java.util.Arrays.* ;

import java.util.*;
import java.io.*;

public class Main
{
    int n ;
    int [] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59} ;
    int [] msk ;
    int [] a ;
    int [][] memo ; // n * (1 << 10)
    StringBuilder sb = new StringBuilder() ;

    int getIdx(int x)
    {
        for(int i = 0 ; i < primes.length ; i++)
            if(x == primes[i])
                return i ;
        return -1 ;
    }
    int dp(int idx , int m)
    {
        if(idx == n)
            return 0 ;
        if(memo[idx][m] != -1)
            return memo[idx][m] ;
        int ans = 1 << 30 ;
        for(int x = 1 ; x <= 61 ; x ++ )
            if((m & msk[x]) == 0)
                ans = min(ans , abs(x - a[idx]) + dp(idx + 1 , m | msk[x])) ;
        return memo[idx][m] = ans ;
    }
    void print(int idx , int m)
    {
        if(idx == n)
            return ;
        for(int x = 1 ; x <= 61 ; x++)
            if((m & msk[x]) == 0 &&  abs(x - a[idx]) + dp(idx + 1 , m | msk[x]) == dp(idx , m))
            {
                sb.append(x).append(' ') ;
                print(idx + 1 , m | msk[x]);
                return;
            }
    }
    void main() throws Exception
    {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        n = sc.nextInt() ;
        msk = new int [62] ;
        for(int i = 2 ; i <= 61 ; i ++)
        {
            int x = i ;
            for(int j : primes)
                while(x % j == 0)
                {
                    x /= j ;
                    msk[i] |= 1 << getIdx(j) ;
                }
        }
        a = new int [n] ;
        for(int i = 0 ; i < n ; i++)
            a[i] = sc.nextInt() ;
        memo = new int [n][1 << 18] ;
        for(int i  =0 ; i < n ;i ++)
            fill(memo[i] , -1);
        dp(0 , 0);
        print(0 , 0);
        out.println(sb);
        out.flush();
        out.close();
    }

    class Scanner
    {
        BufferedReader br;
        StringTokenizer st;

        Scanner(InputStream in)
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws Exception
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        int nextInt() throws Exception { return Integer.parseInt(next()); }

        long nextLong() throws Exception { return Long.parseLong(next()); }

        double nextDouble() throws Exception { return Double.parseDouble(next());}
    }

    public static void main (String [] args) throws Exception {(new Main()).main();}

}
