def resolve():
    A, B, K = map(int, input().split())
    ans = [1]
    for i in range(2, min(A, B)+1):
        if A%i == 0 and B%i == 0:
            ans.append(i)
    print(ans[K*-1])
resolve() def resolve():
    A, B, K = map(int, input().split())
    ans = [1]
    for i in range(2, min(A, B)+1):
        if A%i == 0 and B%i == 0:
            ans.append(i)
    print(ans[K*-1]) resolve A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K ans = [1] ans [1] 1 for i in range(2, min(A, B)+1):
        if A%i == 0 and B%i == 0:
            ans.append(i)
     i range(2, min(A, B)+1) range 2 min(A, B)+1 min(A, B) min A B 1 if A%i == 0 and B%i == 0:
            ans.append(i)
     A%i == 0 and B%i == 0 A%i == 0 A%i A i 0 B%i == 0 B%i B i 0 ans.append(i) ans.append ans append i print(ans[K*-1]) print ans[K*-1] ans K*-1 K -1 resolve() resolve def resolve():
    A, B, K = map(int, input().split())
    ans = [1]
    for i in range(2, min(A, B)+1):
        if A%i == 0 and B%i == 0:
            ans.append(i)
    print(ans[K*-1]) def resolve():
    A, B, K = map(int, input().split())
    ans = [1]
    for i in range(2, min(A, B)+1):
        if A%i == 0 and B%i == 0:
            ans.append(i)
    print(ans[K*-1]) resolve
def resolve():
    A, B, K = map(int, input().split())
    ans = [1]
    for i in range(2, min(A, B)+1):
        if A%i == 0 and B%i == 0:
            ans.append(i)
    print(ans[K*-1])
resolve()