A, B, K = map(int, input().split())
ans = 0
curr = min(A, B)
while K > 0:
    if A % curr == 0 and B % curr == 0:
        K -= 1
        ans = curr
    curr -= 1
print(ans) A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K ans = 0 ans 0 curr = min(A, B) curr min(A, B) min A B while K > 0:
    if A % curr == 0 and B % curr == 0:
        K -= 1
        ans = curr
    curr -= 1 K > 0 K 0 if A % curr == 0 and B % curr == 0:
        K -= 1
        ans = curr
     A % curr == 0 and B % curr == 0 A % curr == 0 A % curr A curr 0 B % curr == 0 B % curr B curr 0 K -= 1 K 1 ans = curr ans curr curr -= 1 curr 1 print(ans) print ans K = map(int, input().split()) map(int, input().split()) K K -= 1 1 K B, K = map(int, input().split()) map(int, input().split()) B ans = 0 0 ans ans = curr curr ans curr -= 1 1 curr curr = min(A, B) min(A, B) curr A, B, K = map(int, input().split()) map(int, input().split()) A
A, B, K = map(int, input().split())
ans = 0
curr = min(A, B)
while K > 0:
    if A % curr == 0 and B % curr == 0:
        K -= 1
        ans = curr
    curr -= 1
print(ans)