A,B,K = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
    
lstA = make_divisors(A)
lstB = make_divisors(B)
#print(lstA,lstB)
fin = []

for i in lstA:
    if i in lstB:
        fin.append(i)
#print(fin)
fin.sort(reverse = True)
print(fin[K-1]) A,B,K = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
     make_divisors divisors = [] divisors [] for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//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:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

     n % i == 0 n % i n i 0 divisors.append(i) divisors.append divisors append i if i != n // i:
                divisors.append(n//i)

     i != n // i i n // i n i divisors.append(n//i) divisors.append divisors append n//i n i divisors.sort() divisors.sort divisors sort return divisors divisors n n lstA = make_divisors(A) lstA make_divisors(A) make_divisors A lstB = make_divisors(B) lstB make_divisors(B) make_divisors B fin = [] fin [] for i in lstA:
    if i in lstB:
        fin.append(i)
#print(fin) i lstA if i in lstB:
        fin.append(i)
#print(fin) i in lstB i lstB fin.append(i) fin.append fin append i fin.sort(reverse = True) fin.sort fin sort reverse = True reverse True print(fin[K-1]) print fin[K-1] fin K-1 K 1 def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
     def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
     make_divisors fin = [] [] fin B,K = map(int,input().split()) map(int,input().split()) B lstA = make_divisors(A) make_divisors(A) lstA lstB = make_divisors(B) make_divisors(B) lstB K = map(int,input().split()) map(int,input().split()) K A,B,K = map(int,input().split()) map(int,input().split()) A
A,B,K = map(int,input().split())
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
    
lstA = make_divisors(A)
lstB = make_divisors(B)
#print(lstA,lstB)
fin = []

for i in lstA:
    if i in lstB:
        fin.append(i)
#print(fin)
fin.sort(reverse = True)
print(fin[K-1])
