import math

num1, num2, target = map(int, input().split())

number = math.gcd(num1, num2)

table = []
for j in range(1, number+1):
    if number % j == 0:
        table.append(j)
list.sort(table, reverse=True)

print(table[target-1]) import math math num1, num2, target = map(int, input().split()) num1 map(int, input().split()) map int input().split() ().split () input split num2 target number = math.gcd(num1, num2) number math.gcd(num1, num2) math.gcd math gcd num1 num2 table = [] table [] for j in range(1, number+1):
    if number % j == 0:
        table.append(j) j range(1, number+1) range 1 number+1 number 1 if number % j == 0:
        table.append(j) number % j == 0 number % j number j 0 table.append(j) table.append table append j list.sort(table, reverse=True) list.sort list sort table reverse=True reverse True print(table[target-1]) print table[target-1] table target-1 target 1 num2, target = map(int, input().split()) map(int, input().split()) num2 table = [] [] table num1, num2, target = map(int, input().split()) map(int, input().split()) num1 number = math.gcd(num1, num2) math.gcd(num1, num2) number target = map(int, input().split()) map(int, input().split()) target
import math

num1, num2, target = map(int, input().split())

number = math.gcd(num1, num2)

table = []
for j in range(1, number+1):
    if number % j == 0:
        table.append(j)
list.sort(table, reverse=True)

print(table[target-1])
