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.io.*;
import java.util.*;

public class B implements Runnable{
	public static void main (String[] args) {new Thread(null, new B(), "_cf", 1 << 28).start();}

	int[] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59};
	int[][] nums;
	int[] newMasks;
	int n, a[], dp[][], num[][], nextMsk[][];
	
	public void run() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("Go!");

		int len = primes.length;
		nums = new int[1 << len][];
		nums[0] = new int[60];
		for(int i = 1; i <= 60; i++) {
			nums[0][i-1] = i;
		}
		for(int mask = 1; mask < nums.length; mask++) {
			int build = mask - (Integer.lowestOneBit(mask));
			int[] it = nums[build];
			int[] next = new int[60];
			int ptr = 0;
			int newPrime = primes[Integer.numberOfTrailingZeros(Integer.lowestOneBit(mask))];
			for(int i : it) {
				int x = i;
				if(x % newPrime == 0) continue;
				next[ptr++] = x;
			}
			nums[mask] = Arrays.copyOfRange(next, 0, ptr);
		}
		newMasks = new int[61];
		for(int i = 2; i < 61; i++) {
			int ptr = 0;
			int at = i;
			int mask = 0;
			while(ptr < primes.length && at > 1) {
				while(at % primes[ptr] == 0 && at > 1) {
					at /= primes[ptr];
					mask |= (1 << ptr);
				}
				ptr++;
			}
			newMasks[i] = mask;
		}
		
		n = fs.nextInt();
		a = fs.nextIntArray(n);
		
		if(n == 1) {
			System.out.println(a[0]);
			return;
		}

		dp = new int[n][1 << len];
		num = new int[n][1 << len];
		nextMsk = new int[n][1 << len];
		for(int[] d : dp) Arrays.fill(d, -1);
		solve(0, 0);
		int curMask = 0, curPos = 0;
		while(curPos < n) {
			out.print(num[curPos][curMask] + " ");
			curMask = nextMsk[curPos++][curMask];
		}
		out.println();
//		out.println(solve(0, 0));
		
		out.close();
	}
	
	int solve(int pos, int mask) {
		if(pos == n) return 0;
		if(dp[pos][mask] != -1) return dp[pos][mask];
		int res = (int)1e9;
		int fill = -1;
		int nextMask = -1;
		for(int x : nums[mask]) {
			int go = solve(pos+1, mask | newMasks[x]) + Math.abs(x - a[pos]);
			if(go < res) {
				res = go;
				nextMask = mask | newMasks[x];
				fill = x;
			}
		}
		num[pos][mask] = fill;
		nextMsk[pos][mask] = nextMask;
		return dp[pos][mask] = res;
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}

	}

}