import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, k = map(int, readline().split())
    res = dict()
    cnt = 0

    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            cnt += 1
            res[cnt] = i

    num = (cnt + 1) - k
    print(res[num])


if __name__ == '__main__':
    main() import sys sys readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 INF = float('INF') INF float('INF') float 'INF' sys.setrecursionlimit(10 ** 5) sys.setrecursionlimit sys setrecursionlimit 10 ** 5 10 5 def main():
    a, b, k = map(int, readline().split())
    res = dict()
    cnt = 0

    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            cnt += 1
            res[cnt] = i

    num = (cnt + 1) - k
    print(res[num]) main a, b, k = map(int, readline().split()) a map(int, readline().split()) map int readline().split() ().split () readline split b k res = dict() res dict() dict cnt = 0 cnt 0 for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            cnt += 1
            res[cnt] = i

     i range(1, 101) range 1 101 if a % i == 0 and b % i == 0:
            cnt += 1
            res[cnt] = i

     a % i == 0 and b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 cnt += 1 cnt 1 res[cnt] = i res[cnt] res cnt i num = (cnt + 1) - k num (cnt + 1) - k cnt + 1 cnt 1 k print(res[num]) print res[num] res num if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    a, b, k = map(int, readline().split())
    res = dict()
    cnt = 0

    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            cnt += 1
            res[cnt] = i

    num = (cnt + 1) - k
    print(res[num]) def main():
    a, b, k = map(int, readline().split())
    res = dict()
    cnt = 0

    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            cnt += 1
            res[cnt] = i

    num = (cnt + 1) - k
    print(res[num]) main MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD readline = sys.stdin.readline sys.stdin.readline readline INF = float('INF') float('INF') INF
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, k = map(int, readline().split())
    res = dict()
    cnt = 0

    for i in range(1, 101):
        if a % i == 0 and b % i == 0:
            cnt += 1
            res[cnt] = i

    num = (cnt + 1) - k
    print(res[num])


if __name__ == '__main__':
    main()
