import sys
import math

input = sys.stdin.readline

A,B,K = list(map(int,input().split()))
counter = []
num = 0
while num <101:
    num += 1
    if A %num ==0 and B % num ==0:
        counter.append(num)
    
print(counter[-K]) import sys sys import math math input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline A,B,K = list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split B K counter = [] counter [] num = 0 num 0 while num <101:
    num += 1
    if A %num ==0 and B % num ==0:
        counter.append(num)
     num <101 num 101 num += 1 num 1 if A %num ==0 and B % num ==0:
        counter.append(num)
     A %num ==0 and B % num ==0 A %num ==0 A %num A num 0 B % num ==0 B % num B num 0 counter.append(num) counter.append counter append num print(counter[-K]) print counter[-K] counter -K K counter = [] [] counter num += 1 1 num num = 0 0 num A,B,K = list(map(int,input().split())) list(map(int,input().split())) A input = sys.stdin.readline sys.stdin.readline input K = list(map(int,input().split())) list(map(int,input().split())) K B,K = list(map(int,input().split())) list(map(int,input().split())) B
import sys
import math

input = sys.stdin.readline

A,B,K = list(map(int,input().split()))
counter = []
num = 0
while num <101:
    num += 1
    if A %num ==0 and B % num ==0:
        counter.append(num)
    
print(counter[-K])
