import sys
a , b , k =map(int,input().split())
count = 0
for i in range(a,0,-1):
    if a % i == 0:
        if b % i == 0:
            count += 1
            if count == k:
                print(i)
                sys.exit() import sys sys a , b , k =map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k count = 0 count 0 for i in range(a,0,-1):
    if a % i == 0:
        if b % i == 0:
            count += 1
            if count == k:
                print(i)
                sys.exit() i range(a,0,-1) range a 0 -1 if a % i == 0:
        if b % i == 0:
            count += 1
            if count == k:
                print(i)
                sys.exit() a % i == 0 a % i a i 0 if b % i == 0:
            count += 1
            if count == k:
                print(i)
                sys.exit() b % i == 0 b % i b i 0 count += 1 count 1 if count == k:
                print(i)
                sys.exit() count == k count k print(i) print i sys.exit() sys.exit sys exit a , b , k =map(int,input().split()) map(int,input().split()) a k =map(int,input().split()) map(int,input().split()) k count = 0 0 count count += 1 1 count b , k =map(int,input().split()) map(int,input().split()) b
import sys
a , b , k =map(int,input().split())
count = 0
for i in range(a,0,-1):
    if a % i == 0:
        if b % i == 0:
            count += 1
            if count == k:
                print(i)
                sys.exit()