a,b,k=map(int,input().split())
n=0
for i in range(min(a,b),0,-1):
    if (a/i==a//i) and (b/i==b//i):
        n+=1
        if n==k:
            print(i)
            exit() a,b,k=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k n=0 n 0 for i in range(min(a,b),0,-1):
    if (a/i==a//i) and (b/i==b//i):
        n+=1
        if n==k:
            print(i)
            exit() i range(min(a,b),0,-1) range min(a,b) min a b 0 -1 if (a/i==a//i) and (b/i==b//i):
        n+=1
        if n==k:
            print(i)
            exit() (a/i==a//i) and (b/i==b//i) a/i==a//i a/i a i a//i a i b/i==b//i b/i b i b//i b i n+=1 n 1 if n==k:
            print(i)
            exit() n==k n k print(i) print i exit() exit k=map(int,input().split()) map(int,input().split()) k n=0 0 n n+=1 1 n a,b,k=map(int,input().split()) map(int,input().split()) a b,k=map(int,input().split()) map(int,input().split()) b
a,b,k=map(int,input().split())
n=0
for i in range(min(a,b),0,-1):
    if (a/i==a//i) and (b/i==b//i):
        n+=1
        if n==k:
            print(i)
            exit()
