# author:  Taichicchi
# created: 10.09.2020 08:12:15

import sys

A, B, K = map(int, input().split())

cnt = 0

ls = []

for k in range(1, max(A, B) + 1):
    if (A % k == 0) & (B % k == 0):
        cnt += 1
        ls.append(k)

print(ls[-K]) import sys sys A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K cnt = 0 cnt 0 ls = [] ls [] for k in range(1, max(A, B) + 1):
    if (A % k == 0) & (B % k == 0):
        cnt += 1
        ls.append(k) k range(1, max(A, B) + 1) range 1 max(A, B) + 1 max(A, B) max A B 1 if (A % k == 0) & (B % k == 0):
        cnt += 1
        ls.append(k) (A % k == 0) & (B % k == 0) A % k == 0 A % k A k 0 B % k == 0 B % k B k 0 cnt += 1 cnt 1 ls.append(k) ls.append ls append k print(ls[-K]) print ls[-K] ls -K 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 ls = [] [] ls cnt += 1 1 cnt cnt = 0 0 cnt
# author:  Taichicchi
# created: 10.09.2020 08:12:15

import sys

A, B, K = map(int, input().split())

cnt = 0

ls = []

for k in range(1, max(A, B) + 1):
    if (A % k == 0) & (B % k == 0):
        cnt += 1
        ls.append(k)

print(ls[-K])