import sys
from collections import deque
from itertools import *


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


A, B, K = LI()
l = []
for i in range(1,100+1):
    if A % i == 0 and B % i == 0:
        l.append(i)

l.reverse()
print(l[K-1]) import sys sys from collections import deque from itertools import * def I(): return int(sys.stdin.readline().rstrip()) I def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) LI def S(): return sys.stdin.readline().rstrip() S def LS(): return list(sys.stdin.readline().rstrip().split()) LS A, B, K = LI() A LI() LI B K l = [] l [] for i in range(1,100+1):
    if A % i == 0 and B % i == 0:
        l.append(i) i range(1,100+1) range 1 100+1 100 1 if A % i == 0 and B % i == 0:
        l.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 l.append(i) l.append l append i l.reverse() l.reverse l reverse print(l[K-1]) print l[K-1] l K-1 K 1 A, B, K = LI() LI() A K = LI() LI() K l = [] [] l def LS(): return list(sys.stdin.readline().rstrip().split()) def LS(): return list(sys.stdin.readline().rstrip().split()) LS B, K = LI() LI() B def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) LI def S(): return sys.stdin.readline().rstrip() def S(): return sys.stdin.readline().rstrip() S
import sys
from collections import deque
from itertools import *


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


A, B, K = LI()
l = []
for i in range(1,100+1):
    if A % i == 0 and B % i == 0:
        l.append(i)

l.reverse()
print(l[K-1])
