import math
A,B,M = map(int,input().split())
C = math.gcd(A,B)
ls = []
for i in range(1,101):
    if C % i == 0:
        ls.append(i)
ls.sort()
print(ls[-M]) import math math A,B,M = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B M C = math.gcd(A,B) C math.gcd(A,B) math.gcd math gcd A B ls = [] ls [] for i in range(1,101):
    if C % i == 0:
        ls.append(i) i range(1,101) range 1 101 if C % i == 0:
        ls.append(i) C % i == 0 C % i C i 0 ls.append(i) ls.append ls append i ls.sort() ls.sort ls sort print(ls[-M]) print ls[-M] ls -M M ls = [] [] ls M = map(int,input().split()) map(int,input().split()) M A,B,M = map(int,input().split()) map(int,input().split()) A C = math.gcd(A,B) math.gcd(A,B) C B,M = map(int,input().split()) map(int,input().split()) B
import math
A,B,M = map(int,input().split())
C = math.gcd(A,B)
ls = []
for i in range(1,101):
    if C % i == 0:
        ls.append(i)
ls.sort()
print(ls[-M])