import math

a, b, k = list(map(int, input().split()))

d = math.gcd(a, b)

e = d + 1
l = 0
while True:
    e -= 1
    if d % e == 0:
        l += 1
        if l == k:
            break


print(e) import math math 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 d = math.gcd(a, b) d math.gcd(a, b) math.gcd math gcd a b e = d + 1 e d + 1 d 1 l = 0 l 0 while True:
    e -= 1
    if d % e == 0:
        l += 1
        if l == k:
            break True e -= 1 e 1 if d % e == 0:
        l += 1
        if l == k:
            break d % e == 0 d % e d e 0 l += 1 l 1 if l == k:
            break l == k l k break print(e) print e d = math.gcd(a, b) math.gcd(a, b) d l += 1 1 l a, b, k = list(map(int, input().split())) list(map(int, input().split())) a b, k = list(map(int, input().split())) list(map(int, input().split())) b e = d + 1 d + 1 e l = 0 0 l e -= 1 1 e k = list(map(int, input().split())) list(map(int, input().split())) k
import math

a, b, k = list(map(int, input().split()))

d = math.gcd(a, b)

e = d + 1
l = 0
while True:
    e -= 1
    if d % e == 0:
        l += 1
        if l == k:
            break


print(e)