import sys
import os
import math

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

C = min(A, B)
hairetu = []

for i in range(1, C+1):
    if A % i == 0 and B % i == 0:
        hairetu.append(i)

print(hairetu[-K]) import sys sys import os os import math math A,B,K=map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K C = min(A, B) C min(A, B) min A B hairetu = [] hairetu [] for i in range(1, C+1):
    if A % i == 0 and B % i == 0:
        hairetu.append(i) i range(1, C+1) range 1 C+1 C 1 if A % i == 0 and B % i == 0:
        hairetu.append(i) A % i == 0 and B % i == 0 A % i == 0 A % i A i 0 B % i == 0 B % i B i 0 hairetu.append(i) hairetu.append hairetu append i print(hairetu[-K]) print hairetu[-K] hairetu -K K A,B,K=map(int, input().split()) map(int, input().split()) A B,K=map(int, input().split()) map(int, input().split()) B C = min(A, B) min(A, B) C hairetu = [] [] hairetu K=map(int, input().split()) map(int, input().split()) K
import sys
import os
import math

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

C = min(A, B)
hairetu = []

for i in range(1, C+1):
    if A % i == 0 and B % i == 0:
        hairetu.append(i)

print(hairetu[-K])