import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    a, b, k = LI()
    v = []
    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            v.append(i)
    v = v[::-1]
    print(v[k-1])


main()
 import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools math string itertools fractions heapq collections re array bisect sys random time copy functools from collections import deque sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 inf = 10**20 inf 10**20 10 20 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 DR = [1, -1, 0, 0] DR [1, -1, 0, 0] 1 -1 0 0 DC = [0, 0, 1, -1] DC [0, 0, 1, -1] 0 0 1 -1 int(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) int x def LI(): return [int(x) for x in sys.stdin.readline().split()] LI int(x)-1 for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x)-1 int(x) int x 1 def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ float(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() float(x) float x def LF(): return [float(x) for x in sys.stdin.readline().split()] LF def LS(): return sys.stdin.readline().split() LS def I(): return int(sys.stdin.readline()) I def F(): return float(sys.stdin.readline()) F def S(): return input()
      S def main():
    a, b, k = LI()
    v = []
    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            v.append(i)
    v = v[::-1]
    print(v[k-1]) main a, b, k = LI() a LI() LI b k v = [] v [] for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            v.append(i)
     i range(1, 101) range 1 101 if a % i == 0 and b % i == 0:
            v.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 v.append(i) v.append v append i v = v[::-1] v v[::-1] v ::-1 -1 print(v[k-1]) print v[k-1] v k-1 k 1 main() main inf = 10**20 10**20 inf def LS(): return sys.stdin.readline().split() def LS(): return sys.stdin.readline().split() LS def LF(): return [float(x) for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] LF mod = 10**9 + 7 10**9 + 7 mod def S(): return input()
      def S(): return input()
      S def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I def F(): return float(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) F def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI(): return [int(x) for x in sys.stdin.readline().split()] LI DR = [1, -1, 0, 0] [1, -1, 0, 0] DR DC = [0, 0, 1, -1] [0, 0, 1, -1] DC def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ def main():
    a, b, k = LI()
    v = []
    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            v.append(i)
    v = v[::-1]
    print(v[k-1]) def main():
    a, b, k = LI()
    v = []
    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            v.append(i)
    v = v[::-1]
    print(v[k-1]) main
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    a, b, k = LI()
    v = []
    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            v.append(i)
    v = v[::-1]
    print(v[k-1])


main()

