A,B,K=map(int,input().split())
check=list()
for i in range(1,min(A,B)+1):
  if A%i==B%i==0:
    check.append(i)
print(check[-K]) A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K check=list() check list() list for i in range(1,min(A,B)+1):
  if A%i==B%i==0:
    check.append(i) i range(1,min(A,B)+1) range 1 min(A,B)+1 min(A,B) min A B 1 if A%i==B%i==0:
    check.append(i) A%i==B%i==0 A%i==B%i A%i A i B%i B i 0 check.append(i) check.append check append i print(check[-K]) print check[-K] check -K K check=list() list() check A,B,K=map(int,input().split()) map(int,input().split()) A K=map(int,input().split()) map(int,input().split()) K B,K=map(int,input().split()) map(int,input().split()) B
A,B,K=map(int,input().split())
check=list()
for i in range(1,min(A,B)+1):
  if A%i==B%i==0:
    check.append(i)
print(check[-K])
