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

ans=0
res=0
for i in range(min(A, B), 0, -1):
    if A%i==0 and B%i==0:
        res+=1
        if res==K:
            ans=i
            break

print(ans) A, B, K = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split B K ans=0 ans 0 res=0 res 0 for i in range(min(A, B), 0, -1):
    if A%i==0 and B%i==0:
        res+=1
        if res==K:
            ans=i
            break i range(min(A, B), 0, -1) range min(A, B) min A B 0 -1 if A%i==0 and B%i==0:
        res+=1
        if res==K:
            ans=i
            break A%i==0 and B%i==0 A%i==0 A%i A i 0 B%i==0 B%i B i 0 res+=1 res 1 if res==K:
            ans=i
            break res==K res K ans=i ans i break print(ans) print ans A, B, K = list(map(int, input().split())) list(map(int, input().split())) A ans=i i ans B, K = list(map(int, input().split())) list(map(int, input().split())) B res+=1 1 res ans=0 0 ans K = list(map(int, input().split())) list(map(int, input().split())) K res=0 0 res
A, B, K = list(map(int, input().split()))

ans=0
res=0
for i in range(min(A, B), 0, -1):
    if A%i==0 and B%i==0:
        res+=1
        if res==K:
            ans=i
            break

print(ans)