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.List;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Comparator;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.util.Collections;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author AlexFetisov
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    int best;
    int[] bestSeq;
    int[] init;
    Integer[] sortedInit;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        init = new int[n];
        sortedInit = new Integer[n];
        for (int i = 0; i < n; ++i) {
            init[i] = in.nextInt();
            sortedInit[i] = i;
        }

        Arrays.sort(sortedInit, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return init[o1] - init[o2];
            }
        });
        bestSeq = new int[n];
        best = Integer.MAX_VALUE / 2;
        cur = new ArrayList<Integer>();
        rec(1, 0);
        for (int i = 0; i < n; ++i) {
            out.print(bestSeq[i] + " ");
        }
        out.println();
    }

    List<Integer> cur;
    final int MAXN = 62;

    private void rec(int id, int prev) {
        checkIt();
        for (int c = prev + 1; c <= MAXN; ++c) {
            boolean ok = true;
            for (int x : cur) {
                if (IntegerUtils.gcd(x, c) != 1) {
                    ok = false;
                    break;
                }
            }
            if (ok) {
                cur.add(c);
                rec(id + 1, c);
                cur.remove(cur.size() - 1);
                if (c > 32) {
                    break;
                }
            }
        }
    }

    private void checkIt() {
        List<Integer> cc = new ArrayList<Integer>(cur);
        while (cc.size() < init.length) {
            cc.add(1);
        }
        Collections.sort(cc);
        int cAns = 0;
        int[] seq = new int[init.length];
        for (int i = 0; i < init.length; ++i) {
            seq[sortedInit[i]] = cc.get(i);
            cAns += Math.abs(seq[sortedInit[i]] - init[sortedInit[i]]);
        }
        if (best > cAns) {
            best = cAns;
            bestSeq = seq.clone();
        }
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer stt;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public String nextLine() {
        try {
            return reader.readLine().trim();
        } catch (IOException e) {
            return null;
        }
    }

    public String nextString() {
        while (stt == null || !stt.hasMoreTokens()) {
            stt = new StringTokenizer(nextLine());
        }
        return stt.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(nextString());
    }

}

class IntegerUtils {

    public static int gcd(int x, int y) {
        return y == 0 ? x : gcd(y, x % y);
    }

}

