import numpy as np

def yakusu(n):
    a = []
    for i in range(1, int(n*0.5)+1):
        if n % i == 0:
            a.append(i)
    a.append(n)
    return a

A, B, K = map(int, input().split())
a = yakusu(A)
b = yakusu(B)
ab = []
for i in a:
    if i in b:
        ab.append(i)
print(ab[-1*K]) import numpy as np numpy def yakusu(n):
    a = []
    for i in range(1, int(n*0.5)+1):
        if n % i == 0:
            a.append(i)
    a.append(n)
    return a yakusu a = [] a [] for i in range(1, int(n*0.5)+1):
        if n % i == 0:
            a.append(i)
     i range(1, int(n*0.5)+1) range 1 int(n*0.5)+1 int(n*0.5) int n*0.5 n 0.5 1 if n % i == 0:
            a.append(i)
     n % i == 0 n % i n i 0 a.append(i) a.append a append i a.append(n) a.append a append n return a a n n A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K a = yakusu(A) a yakusu(A) yakusu A b = yakusu(B) b yakusu(B) yakusu B ab = [] ab [] for i in a:
    if i in b:
        ab.append(i) i a if i in b:
        ab.append(i) i in b i b ab.append(i) ab.append ab append i print(ab[-1*K]) print ab[-1*K] ab -1*K -1 K K = map(int, input().split()) map(int, input().split()) K b = yakusu(B) yakusu(B) b B, K = map(int, input().split()) map(int, input().split()) B A, B, K = map(int, input().split()) map(int, input().split()) A def yakusu(n):
    a = []
    for i in range(1, int(n*0.5)+1):
        if n % i == 0:
            a.append(i)
    a.append(n)
    return a def yakusu(n):
    a = []
    for i in range(1, int(n*0.5)+1):
        if n % i == 0:
            a.append(i)
    a.append(n)
    return a yakusu ab = [] [] ab a = yakusu(A) yakusu(A) a
import numpy as np

def yakusu(n):
    a = []
    for i in range(1, int(n*0.5)+1):
        if n % i == 0:
            a.append(i)
    a.append(n)
    return a

A, B, K = map(int, input().split())
a = yakusu(A)
b = yakusu(B)
ab = []
for i in a:
    if i in b:
        ab.append(i)
print(ab[-1*K])