a, b, k = map(int, input().split())

cnt = 0
for i in range(1, 200):
    if(a%i == 0 and b%i == 0):
        cnt = cnt + 1;

cnts = cnt - k + 1
cnt = 0
for i in range(1, 200):
    if(a%i == 0 and b%i == 0):
        cnt = cnt + 1;
    if(cnt == cnts):
        print(i)
        break a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k cnt = 0 cnt 0 for i in range(1, 200):
    if(a%i == 0 and b%i == 0):
        cnt = cnt + 1; i range(1, 200) range 1 200 if(a%i == 0 and b%i == 0):
        cnt = cnt + 1; a%i == 0 and b%i == 0 a%i == 0 a%i a i 0 b%i == 0 b%i b i 0 cnt = cnt + 1 cnt cnt + 1 cnt 1 cnts = cnt - k + 1 cnts cnt - k + 1 cnt - k cnt k 1 cnt = 0 cnt 0 for i in range(1, 200):
    if(a%i == 0 and b%i == 0):
        cnt = cnt + 1;
    if(cnt == cnts):
        print(i)
        break i range(1, 200) range 1 200 if(a%i == 0 and b%i == 0):
        cnt = cnt + 1;
     a%i == 0 and b%i == 0 a%i == 0 a%i a i 0 b%i == 0 b%i b i 0 cnt = cnt + 1 cnt cnt + 1 cnt 1 if(cnt == cnts):
        print(i)
        break cnt == cnts cnt cnts print(i) print i break cnt = 0 0 cnt cnt = cnt + 1 cnt + 1 cnt k = map(int, input().split()) map(int, input().split()) k b, k = map(int, input().split()) map(int, input().split()) b cnt = cnt + 1 cnt + 1 cnt cnts = cnt - k + 1 cnt - k + 1 cnts a, b, k = map(int, input().split()) map(int, input().split()) a cnt = 0 0 cnt
a, b, k = map(int, input().split())

cnt = 0
for i in range(1, 200):
    if(a%i == 0 and b%i == 0):
        cnt = cnt + 1;

cnts = cnt - k + 1
cnt = 0
for i in range(1, 200):
    if(a%i == 0 and b%i == 0):
        cnt = cnt + 1;
    if(cnt == cnts):
        print(i)
        break
