A,B,K=map(int,input().split())
k=0
n=min(A,B)
while 1:
  if A%n==0 and B%n==0:
    k+=1
  if K==k:
    break
  n-=1
print (n) A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K k=0 k 0 n=min(A,B) n min(A,B) min A B while 1:
  if A%n==0 and B%n==0:
    k+=1
  if K==k:
    break
  n-=1 1 if A%n==0 and B%n==0:
    k+=1
   A%n==0 and B%n==0 A%n==0 A%n A n 0 B%n==0 B%n B n 0 k+=1 k 1 if K==k:
    break
   K==k K k break n-=1 n 1 print (n) print n K=map(int,input().split()) map(int,input().split()) K n=min(A,B) min(A,B) n B,K=map(int,input().split()) map(int,input().split()) B k=0 0 k k+=1 1 k n-=1 1 n A,B,K=map(int,input().split()) map(int,input().split()) A
A,B,K=map(int,input().split())
k=0
n=min(A,B)
while 1:
  if A%n==0 and B%n==0:
    k+=1
  if K==k:
    break
  n-=1
print (n)
