A,B,K=map(int,input().split())

mamax=max(A,B)
count=0
for i in range(mamax,0,-1):
    if(A%i==0 and B%i==0):

        count=count+1
        if(count==K):
            print(i)
            exit() A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K mamax=max(A,B) mamax max(A,B) max A B count=0 count 0 for i in range(mamax,0,-1):
    if(A%i==0 and B%i==0):

        count=count+1
        if(count==K):
            print(i)
            exit() i range(mamax,0,-1) range mamax 0 -1 if(A%i==0 and B%i==0):

        count=count+1
        if(count==K):
            print(i)
            exit() A%i==0 and B%i==0 A%i==0 A%i A i 0 B%i==0 B%i B i 0 count=count+1 count count+1 count 1 if(count==K):
            print(i)
            exit() count==K count K print(i) print i exit() exit A,B,K=map(int,input().split()) map(int,input().split()) A K=map(int,input().split()) map(int,input().split()) K count=0 0 count count=count+1 count+1 count B,K=map(int,input().split()) map(int,input().split()) B mamax=max(A,B) max(A,B) mamax
A,B,K=map(int,input().split())

mamax=max(A,B)
count=0
for i in range(mamax,0,-1):
    if(A%i==0 and B%i==0):

        count=count+1
        if(count==K):
            print(i)
            exit()
