from math import gcd
a, b, k = map(int, input().split())

g = gcd(a, b)

for i in range(g, 0, -1):
    if g % i == 0:
        k -= 1
        if k == 0:
            print(i)
            break from math import gcd a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k g = gcd(a, b) g gcd(a, b) gcd a b for i in range(g, 0, -1):
    if g % i == 0:
        k -= 1
        if k == 0:
            print(i)
            break i range(g, 0, -1) range g 0 -1 if g % i == 0:
        k -= 1
        if k == 0:
            print(i)
            break g % i == 0 g % i g i 0 k -= 1 k 1 if k == 0:
            print(i)
            break k == 0 k 0 print(i) print i break g = gcd(a, b) gcd(a, b) g k -= 1 1 k a, b, k = map(int, input().split()) map(int, input().split()) a k = map(int, input().split()) map(int, input().split()) k b, k = map(int, input().split()) map(int, input().split()) b
from math import gcd
a, b, k = map(int, input().split())

g = gcd(a, b)

for i in range(g, 0, -1):
    if g % i == 0:
        k -= 1
        if k == 0:
            print(i)
            break
