def dv(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)
    return divisors
A,B,K = map(int,input().split())
C = list(set(dv(A))&set(dv(B)))
C.sort()
C.reverse()
print(C[K-1]) def dv(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)
    return divisors dv 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 return divisors divisors n n A,B,K = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K C = list(set(dv(A))&set(dv(B))) C list(set(dv(A))&set(dv(B))) list set(dv(A))&set(dv(B)) set(dv(A)) set dv(A) dv A set(dv(B)) set dv(B) dv B C.sort() C.sort C sort C.reverse() C.reverse C reverse print(C[K-1]) print C[K-1] C K-1 K 1 K = map(int,input().split()) map(int,input().split()) K C = list(set(dv(A))&set(dv(B))) list(set(dv(A))&set(dv(B))) C A,B,K = map(int,input().split()) map(int,input().split()) A def dv(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)
    return divisors def dv(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)
    return divisors dv B,K = map(int,input().split()) map(int,input().split()) B
def dv(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)
    return divisors
A,B,K = map(int,input().split())
C = list(set(dv(A))&set(dv(B)))
C.sort()
C.reverse()
print(C[K-1])