A,B, K = map(int, input().split())
def divisor(n):
    div_list = []
    for i in range(1, int(1+ n**0.5)):
        if n%i == 0 and i**2 == n:
            div_list.append(i)
        elif n%i == 0:
            div_list.append(i)
            div_list.append(int(n/i))
    return div_list
lnA = divisor(A)
lnB = divisor(B)
ln = []
for i in lnA:
    if i in lnB:
        ln.append(i)
line = sorted(ln, reverse = True)
print(line[K - 1]) A,B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K def divisor(n):
    div_list = []
    for i in range(1, int(1+ n**0.5)):
        if n%i == 0 and i**2 == n:
            div_list.append(i)
        elif n%i == 0:
            div_list.append(i)
            div_list.append(int(n/i))
    return div_list divisor div_list = [] div_list [] for i in range(1, int(1+ n**0.5)):
        if n%i == 0 and i**2 == n:
            div_list.append(i)
        elif n%i == 0:
            div_list.append(i)
            div_list.append(int(n/i))
     i range(1, int(1+ n**0.5)) range 1 int(1+ n**0.5) int 1+ n**0.5 1 n**0.5 n 0.5 if n%i == 0 and i**2 == n:
            div_list.append(i)
        elif n%i == 0:
            div_list.append(i)
            div_list.append(int(n/i))
     n%i == 0 and i**2 == n n%i == 0 n%i n i 0 i**2 == n i**2 i 2 n div_list.append(i) div_list.append div_list append i elif n%i == 0:
            div_list.append(i)
            div_list.append(int(n/i))
     n%i == 0 n%i n i 0 div_list.append(i) div_list.append div_list append i div_list.append(int(n/i)) div_list.append div_list append int(n/i) int n/i n i return div_list div_list n n lnA = divisor(A) lnA divisor(A) divisor A lnB = divisor(B) lnB divisor(B) divisor B ln = [] ln [] for i in lnA:
    if i in lnB:
        ln.append(i) i lnA if i in lnB:
        ln.append(i) i in lnB i lnB ln.append(i) ln.append ln append i line = sorted(ln, reverse = True) line sorted(ln, reverse = True) sorted ln reverse = True reverse True print(line[K - 1]) print line[K - 1] line K - 1 K 1 lnB = divisor(B) divisor(B) lnB def divisor(n):
    div_list = []
    for i in range(1, int(1+ n**0.5)):
        if n%i == 0 and i**2 == n:
            div_list.append(i)
        elif n%i == 0:
            div_list.append(i)
            div_list.append(int(n/i))
    return div_list def divisor(n):
    div_list = []
    for i in range(1, int(1+ n**0.5)):
        if n%i == 0 and i**2 == n:
            div_list.append(i)
        elif n%i == 0:
            div_list.append(i)
            div_list.append(int(n/i))
    return div_list divisor A,B, K = map(int, input().split()) map(int, input().split()) A B, K = map(int, input().split()) map(int, input().split()) B K = map(int, input().split()) map(int, input().split()) K ln = [] [] ln line = sorted(ln, reverse = True) sorted(ln, reverse = True) line lnA = divisor(A) divisor(A) lnA
A,B, K = map(int, input().split())
def divisor(n):
    div_list = []
    for i in range(1, int(1+ n**0.5)):
        if n%i == 0 and i**2 == n:
            div_list.append(i)
        elif n%i == 0:
            div_list.append(i)
            div_list.append(int(n/i))
    return div_list
lnA = divisor(A)
lnB = divisor(B)
ln = []
for i in lnA:
    if i in lnB:
        ln.append(i)
line = sorted(ln, reverse = True)
print(line[K - 1])