import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

while(len(np.nonzero(A)[0]) != 1):
    devisor = np.min(A[np.nonzero(A)])
    devisor_i = np.where(A==devisor)[0][0]
    A = np.array([A[devisor_i], *(A%devisor)[:devisor_i], *(A%devisor)[devisor_i+1:]])
    
print(*A[np.nonzero(A)]) import numpy as np numpy N = int(input()) N int(input()) int input() input A = np.array(list(map(int, input().split()))) A np.array(list(map(int, input().split()))) np.array np array list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split while(len(np.nonzero(A)[0]) != 1):
    devisor = np.min(A[np.nonzero(A)])
    devisor_i = np.where(A==devisor)[0][0]
    A = np.array([A[devisor_i], *(A%devisor)[:devisor_i], *(A%devisor)[devisor_i+1:]])
     len(np.nonzero(A)[0]) != 1 len(np.nonzero(A)[0]) len np.nonzero(A)[0] np.nonzero(A) np.nonzero np nonzero A 0 1 devisor = np.min(A[np.nonzero(A)]) devisor np.min(A[np.nonzero(A)]) np.min np min A[np.nonzero(A)] A np.nonzero(A) np.nonzero np nonzero A devisor_i = np.where(A==devisor)[0][0] devisor_i np.where(A==devisor)[0][0] [0] np.where(A==devisor) np.where np where A==devisor A devisor 0 0 A = np.array([A[devisor_i], *(A%devisor)[:devisor_i], *(A%devisor)[devisor_i+1:]]) A np.array([A[devisor_i], *(A%devisor)[:devisor_i], *(A%devisor)[devisor_i+1:]]) np.array np array [A[devisor_i], *(A%devisor)[:devisor_i], *(A%devisor)[devisor_i+1:]] A[devisor_i] A devisor_i *(A%devisor)[:devisor_i] (A%devisor)[:devisor_i] A%devisor A devisor :devisor_i devisor_i *(A%devisor)[devisor_i+1:] (A%devisor)[devisor_i+1:] A%devisor A devisor devisor_i+1: devisor_i+1 devisor_i 1 print(*A[np.nonzero(A)]) print *A[np.nonzero(A)] A[np.nonzero(A)] A np.nonzero(A) np.nonzero np nonzero A devisor_i = np.where(A==devisor)[0][0] np.where(A==devisor)[0][0] devisor_i devisor = np.min(A[np.nonzero(A)]) np.min(A[np.nonzero(A)]) devisor A = np.array(list(map(int, input().split()))) np.array(list(map(int, input().split()))) A A = np.array([A[devisor_i], *(A%devisor)[:devisor_i], *(A%devisor)[devisor_i+1:]]) np.array([A[devisor_i], *(A%devisor)[:devisor_i], *(A%devisor)[devisor_i+1:]]) A N = int(input()) int(input()) N
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))

while(len(np.nonzero(A)[0]) != 1):
    devisor = np.min(A[np.nonzero(A)])
    devisor_i = np.where(A==devisor)[0][0]
    A = np.array([A[devisor_i], *(A%devisor)[:devisor_i], *(A%devisor)[devisor_i+1:]])
    
print(*A[np.nonzero(A)])