# Arup Guha
# 4/11/2025
# Solution to Junior Knights Contest Problem: Aldursrodun
# https://open.kattis.com/problems/aldursrodun

# Returns the GCD of a and b.
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

# Returns true if there's a permutation of vals with the first k items of perm fixed that
# satisfies the gcd rule.
def go(perm, used, k, vals):

    # We made it, return the status of this permutation.
    if k == len(used):
        return check(perm, vals)

    # Try each item in slot k.
    for i in range(len(perm)):

        # We used this already skip it.
        if used[i]:
            continue

        # Put i in slot k and try it out.
        used[i] = True
        perm[k] = i

        # If it works, immediately return true.
        res = go(perm, used, k+1, vals)
        if res:
            return True

        # Undo this so we can use it in a future slot.
        used[i] = False

    # If we get here, we never made it.
    return False

# Returns true iff the permutation in perm of vals has all adjacent elements with gcd > 1.
def check(perm, vals):
    for i in range(len(perm)-1):
        if gcd(vals[perm[i]], vals[perm[i+1]]) == 1:
            return False
    return True

# Prints the permutation perm of the values in vals.
def printVals(perm, vals):
    for i in range(len(perm)-1):
        print(vals[perm[i]], end= " ")
    print(vals[perm[-1]])
    
def main():

    # Read input.
    n = int(input())
    vals = [int(x) for x in input().split()]

    # Set up arrays for brute force.
    perm = []
    used = []
    for i in range(n):
        perm.append(0)
        used.append(False)

    # Run it
    res = go(perm, used, 0, vals)

    # Output result.
    if res:
        printVals(perm, vals)
    else:
        print("Neibb")

# Run it.
main()
