import sys
import time
import math
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

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

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr) import sys sys import time time import math math def inpl():
    return list(map(int, input().split())) inpl return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split st = time.perf_counter() st time.perf_counter() time.perf_counter time perf_counter A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K ans = [] ans [] for i in range(1, min(A, B)+1):
	if A%i == 0 and B%i == 0:
		ans.append(i) i range(1, min(A, B)+1) range 1 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[len(ans)-K]) print ans[len(ans)-K] ans len(ans)-K len(ans) len ans K ed = time.perf_counter() ed time.perf_counter() time.perf_counter time perf_counter print('time:', ed-st, file=sys.stderr) print 'time:' ed-st ed st file=sys.stderr file sys.stderr sys stderr ans = [] [] ans K = map(int, input().split()) map(int, input().split()) K def inpl():
    return list(map(int, input().split())) def inpl():
    return list(map(int, input().split())) inpl st = time.perf_counter() time.perf_counter() st ed = time.perf_counter() time.perf_counter() ed B, K = map(int, input().split()) map(int, input().split()) B A, B, K = map(int, input().split()) map(int, input().split()) A
import sys
import time
import math
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

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

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)
