A,B,K=map(int,input().split())

A,B = min(A,B),max(A,B)

count = 0
for i in range(A,0,-1):
  if A%i==0 and B%i==0:
    count += 1
  if count == K:
    print(i)
    break A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K A,B = min(A,B),max(A,B) A min(A,B) min A B B max(A,B) max A B count = 0 count 0 for i in range(A,0,-1):
  if A%i==0 and B%i==0:
    count += 1
  if count == K:
    print(i)
    break i range(A,0,-1) range A 0 -1 if A%i==0 and B%i==0:
    count += 1
   A%i==0 and B%i==0 A%i==0 A%i A i 0 B%i==0 B%i B i 0 count += 1 count 1 if count == K:
    print(i)
    break count == K count K print(i) print i break count += 1 1 count count = 0 0 count K=map(int,input().split()) map(int,input().split()) K A,B,K=map(int,input().split()) map(int,input().split()) A A,B = min(A,B),max(A,B) min(A,B) A B,K=map(int,input().split()) map(int,input().split()) B B = min(A,B),max(A,B) max(A,B) B
A,B,K=map(int,input().split())

A,B = min(A,B),max(A,B)

count = 0
for i in range(A,0,-1):
  if A%i==0 and B%i==0:
    count += 1
  if count == K:
    print(i)
    break