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 java.util.Collections;
import java.util.Scanner;
import java.util.Vector;

public class B {
	public static final boolean DEBUG = false;
	Scanner sc;
	
	public void debug(Object o) {
		if (DEBUG) {
			int ln = Thread.currentThread().getStackTrace()[2].getLineNumber();
			String fn = Thread.currentThread().getStackTrace()[2].getFileName();
			System.out.println("(" + fn + ":" + ln+ "): " + o);
		}
	}
	
	public void pln(Object o) {
		System.out.println(o);
	}
	
	boolean isPrime(int n) {
	   for (int i=2; i<n; i++) if (n%i == 0) return false;
	   return true;
	}
	
	public void run() {
		sc = new Scanner(System.in);		

		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i=0; i<n; i++) a[i] = sc.nextInt();
		
		Vector<Integer> primes = new Vector<Integer>();
		for (int i=2; i<59; i++) if (isPrime(i)) primes.add(i);
		
		int nPrimes = primes.size();
		
		int[][] bestCost = new int[n+1][1 << nPrimes];
      int[][] bestValue = new int[n+1][1 << nPrimes];
		
		for (int i=1; i<=n; i++) {
         for (int mask=0; mask<1<<nPrimes; mask++) {
            bestCost[i][mask] = bestCost[i-1][mask] + Math.abs(a[i-1] - 1);
            bestValue[i][mask] = 1;
         }
         
		   for (int k=1; k<59; k++) {
		      int crtMask = getMask(k, primes);
		      int crtCost = Math.abs(k - a[i-1]);
   		   for (int mask=0; mask<1<<nPrimes; mask++) {
   		      if ((mask & crtMask) == 0) {
   		         if (bestCost[i-1][mask] + crtCost < bestCost[i][mask | crtMask]) {
   		            bestCost[i][mask | crtMask] = bestCost[i-1][mask] + crtCost;
                     bestValue[i][mask | crtMask] = k;
   		         }
   		      }
   		   }
		   }
		}
		
		int crtBestVal = Integer.MAX_VALUE;
		int crtBestMask = 0;
		for (int mask=0; mask<1<<nPrimes; mask++) {
		   if (bestCost[n][mask] < crtBestVal) {
		      crtBestVal = bestCost[n][mask];
		      crtBestMask = mask;
		   }
		}
//		System.out.println(crtBestVal);
		Vector<Integer> res = new Vector<Integer>();
		for (int i=n; i>0; i--) {
		  int val = bestValue[i][crtBestMask];
		  if (val == 0) val = 1;
		  res.add(val);
		  int valMask = getMask(val, primes);
		  crtBestMask ^= valMask;
		}
		
		Collections.reverse(res);
		for (int val: res) System.out.print(val + " ");
	}
	
	private int getMask(int k, Vector<Integer> primes) {
	   int crtMask = 0;
      for (int j=0; j<primes.size(); j++) {
         if (k % primes.get(j) == 0) {
            crtMask |= 1 << j;
         }
      }
      return crtMask;
   }

   public static void main(String[] args) {
		B t = new B();
		t.run();
	}
}