import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


a, b, k = LI()
cds = []
ans = 1
for i in range(1, min(a, b)+1):
    if a % i == 0 and b % i == 0:
        cds.append(i)
print(cds[-k]) import sys sys def input(): return sys.stdin.readline().strip() input def I(): return int(input()) I def LI(): return list(map(int, input().split())) LI I() for i in range(n) for i in range(n) i range(n) range n for i in range(n) I() I def IR(n): return [I() for i in range(n)] IR n n LI() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LI() LI def LIR(n): return [LI() for i in range(n)] LIR n n S() for i in range(n) for i in range(n) i range(n) range n for i in range(n) S() S def SR(n): return [S() for i in range(n)] SR n n def S(): return input() S def LS(): return input().split() LS INF = float('inf') INF float('inf') float 'inf' a, b, k = LI() a LI() LI b k cds = [] cds [] ans = 1 ans 1 for i in range(1, min(a, b)+1):
    if a % i == 0 and b % i == 0:
        cds.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:
        cds.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 cds.append(i) cds.append cds append i print(cds[-k]) print cds[-k] cds -k k def I(): return int(input()) def I(): return int(input()) I b, k = LI() LI() b def IR(n): return [I() for i in range(n)] def IR(n): return [I() for i in range(n)] IR def LIR(n): return [LI() for i in range(n)] def LIR(n): return [LI() for i in range(n)] LIR ans = 1 1 ans k = LI() LI() k INF = float('inf') float('inf') INF def LS(): return input().split() def LS(): return input().split() LS def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI def SR(n): return [S() for i in range(n)] def SR(n): return [S() for i in range(n)] SR def S(): return input() def S(): return input() S cds = [] [] cds a, b, k = LI() LI() a def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


a, b, k = LI()
cds = []
ans = 1
for i in range(1, min(a, b)+1):
    if a % i == 0 and b % i == 0:
        cds.append(i)
print(cds[-k])
