import math

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

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