import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b, k = M()
x = ans = 0
for i in range(101, 0, -1):
    if a%i == 0 and b%i == 0:
        x += 1
    if k == x:
        ans = i
        break
print(ans) import bisect,collections,copy,heapq,itertools,math,string bisect collections copy heapq itertools math string import sys sys def S(): return sys.stdin.readline().rstrip() S def M(): return map(int,sys.stdin.readline().rstrip().split()) M def I(): return int(sys.stdin.readline().rstrip()) I def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) LI def LS(): return list(sys.stdin.readline().rstrip().split()) LS a, b, k = M() a M() M b k x = ans = 0 x 0 = ans = 0 ans 0 for i in range(101, 0, -1):
    if a%i == 0 and b%i == 0:
        x += 1
    if k == x:
        ans = i
        break i range(101, 0, -1) range 101 0 -1 if a%i == 0 and b%i == 0:
        x += 1
     a%i == 0 and b%i == 0 a%i == 0 a%i a i 0 b%i == 0 b%i b i 0 x += 1 x 1 if k == x:
        ans = i
        break k == x k x ans = i ans i break print(ans) print ans def LS(): return list(sys.stdin.readline().rstrip().split()) def LS(): return list(sys.stdin.readline().rstrip().split()) LS k = M() M() k x = ans = 0 0 x ans = i i ans def M(): return map(int,sys.stdin.readline().rstrip().split()) def M(): return map(int,sys.stdin.readline().rstrip().split()) M def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) LI b, k = M() M() b def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I a, b, k = M() M() a x += 1 1 x def S(): return sys.stdin.readline().rstrip() def S(): return sys.stdin.readline().rstrip() S ans = 0 0 ans
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
a, b, k = M()
x = ans = 0
for i in range(101, 0, -1):
    if a%i == 0 and b%i == 0:
        x += 1
    if k == x:
        ans = i
        break
print(ans)