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