import math
A,B,K=map(int,input().split())
anslist=[]
for i in range(1,max(A,B)+1):
    if (A%i==0)&(B%i==0):
        anslist.append(i)
print(anslist[0-K]) import math math A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K anslist=[] anslist [] for i in range(1,max(A,B)+1):
    if (A%i==0)&(B%i==0):
        anslist.append(i) i range(1,max(A,B)+1) range 1 max(A,B)+1 max(A,B) max A B 1 if (A%i==0)&(B%i==0):
        anslist.append(i) (A%i==0)&(B%i==0) A%i==0 A%i A i 0 B%i==0 B%i B i 0 anslist.append(i) anslist.append anslist append i print(anslist[0-K]) print anslist[0-K] anslist 0-K 0 K K=map(int,input().split()) map(int,input().split()) K anslist=[] [] anslist A,B,K=map(int,input().split()) map(int,input().split()) A B,K=map(int,input().split()) map(int,input().split()) B
import math
A,B,K=map(int,input().split())
anslist=[]
for i in range(1,max(A,B)+1):
    if (A%i==0)&(B%i==0):
        anslist.append(i)
print(anslist[0-K])